/*_############################################################################
  _## 
  _##  SNMP4J - ConsoleLogFactory.java  
  _## 
  _##  Copyright (C) 2003-2026  Frank Fock (SNMP4J.org)
  _##  
  _##  Licensed under the Apache License, Version 2.0 (the "License");
  _##  you may not use this file except in compliance with the License.
  _##  You may obtain a copy of the License at
  _##  
  _##      http://www.apache.org/licenses/LICENSE-2.0
  _##  
  _##  Unless required by applicable law or agreed to in writing, software
  _##  distributed under the License is distributed on an "AS IS" BASIS,
  _##  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  _##  See the License for the specific language governing permissions and
  _##  limitations under the License.
  _##  
  _##########################################################################*/
package org.snmp4j.log;

import java.io.PrintStream;

/**
 * The {@code ConsoleLogFactory} implements a SNMP4J LogFactory for
 * system out. In order to use simple stdout logging for SNMP4J, the
 * static {@link LogFactory#setLogFactory} method has to be used before
 * any SNMP4J class is referenced or instantiated.
 *
 * @author Frank Fock
 * @version 3.9.7
 * @since 1.6
 */
public class ConsoleLogFactory extends LogFactory {

  private final ConsoleLogAdapter logAdapter;

  public ConsoleLogFactory() {
      super();
      logAdapter = new ConsoleLogAdapter();
  }

  /**
   * Constructs a {@code ConsoleLogFactory} instance using the specified {@code PrintStream}.
   * This allows log messages to be directed to a custom output stream.
   * Default is {@code System.out} if the default constructor is used.
   *
   * @param outStream
   *        the {@code PrintStream} where log messages will be written.
   * @param errStream
   *        the {@code PrintStream} where error messages will be written.
   * @since 3.9.7
   */
  public ConsoleLogFactory(PrintStream outStream, PrintStream errStream) {
      logAdapter = new ConsoleLogAdapter(outStream, errStream);
  }

  protected LogAdapter createLogger(Class<?> c) {
    return logAdapter;
  }

  protected LogAdapter createLogger(String className) {
    return logAdapter;
  }

  @Override
  public LogAdapter getRootLogger() {
    return logAdapter;
  }
}
