Class EngineLoggingFactory

java.lang.Object
com.blackrook.engine.EngineLoggingFactory

public class EngineLoggingFactory extends Object
Some kind of logger for logging messages.
Author:
Matthew Tropiano
  • Constructor Details

  • Method Details

    • createConsoleLoggingFactory

      public static EngineLoggingFactory createConsoleLoggingFactory()
      A convenience method for creating a Console-appending logger factory.

      Equivalent to: new LoggingFactory(LogLevel.DEBUG, new ConsoleLogger())

      Returns:
      the new logging factory.
    • createConsoleLoggerFor

      public static EngineLoggingFactory.Logger createConsoleLoggerFor(String name)
      A convenience method for creating a Console-appending logger for a particular source by name.

      Equivalent to: createConsoleLoggingFactory().getLogger(name)

      It may be better, thread-resource-wise to create a single factory if you are logging multiple sources/classes through it.

      Parameters:
      name - the source name of this logger.
      Returns:
      the new logger.
      See Also:
    • createConsoleLoggerFor

      public static EngineLoggingFactory.Logger createConsoleLoggerFor(Class<?> clazz)
      A convenience method for creating a Console-appending logger for a particular source by class name.

      Equivalent to: createConsoleLoggingFactory().getLogger(clazz)

      It may be better, thread-resource-wise to create a single factory if you are logging multiple sources/classes through it.

      Parameters:
      clazz - the class to create the logger for.
      Returns:
      the new logger.
      See Also:
    • createConsoleLoggerFor

      public static EngineLoggingFactory.Logger createConsoleLoggerFor(Class<?> clazz, boolean fullyQualified)
      A convenience method for creating a Console-appending logger for a particular source by class name.

      Equivalent to: createConsoleLoggingFactory().getLogger(clazz, fullyQualified)

      It may be better, thread-resource-wise to create a single factory if you are logging multiple sources/classes through it.

      Parameters:
      clazz - the class to create the logger for.
      fullyQualified - if true, the output name is a fully-qualified name.
      Returns:
      the new logger.
      See Also:
    • addDriver

      public void addDriver(EngineLoggingFactory.Driver... drivers)
      Adds a logging driver or drivers from this factory.
      Parameters:
      drivers - the drivers to add.
    • removeDriver

      public void removeDriver(EngineLoggingFactory.Driver... drivers)
      Removes a logging driver or drivers from this factory.
      Parameters:
      drivers - the drivers to remove.
    • getLoggingLevel

      public EngineLoggingFactory.LogLevel getLoggingLevel()
      Returns the current logging level. Anything logged using EngineLoggingFactory.Loggers generated by this factory is tested against the current logging level. If the logging level of the message is less than or equal to the current logging level, it is logged.
      Returns:
      the current logging level.
    • setLoggingLevel

      public void setLoggingLevel(EngineLoggingFactory.LogLevel level)
      Returns the current logging level. Anything logged using EngineLoggingFactory.Loggers generated by this factory is tested against the current logging level. If the logging level of the message is less than or equal to the current logging level, it is logged.
      Parameters:
      level - the new logging level.
    • getLogger

      public EngineLoggingFactory.Logger getLogger(String name)
      Creates a new Logger for outputting logs. This logger uses the logging level and driver defined on this logging factory.
      Parameters:
      name - the source name.
      Returns:
      a logger to call to output logging to.
    • getLogger

      public EngineLoggingFactory.Logger getLogger(Class<?> clz)
      Creates a new Logger for outputting logs, using the name of the class as a source name. This logger uses the logging level and driver defined on this logging factory.
      Parameters:
      clz - the class to use.
      Returns:
      a logger to call to output logging to.
    • getLogger

      public EngineLoggingFactory.Logger getLogger(Class<?> clz, boolean fullyQualified)
      Creates a new Logger for outputting logs, using the name of the class as a source name. This logger uses the logging level and driver defined on this logging factory.
      Parameters:
      clz - the class to use.
      fullyQualified - if true, use the fully-qualified name.
      Returns:
      a logger to call to output logging to.