Class EngineLoggingFactory
java.lang.Object
com.blackrook.engine.EngineLoggingFactory
Some kind of logger for logging messages.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA logger driver that outputs to Standard Out.static interfaceA logging output driver that outputs messages to a log when it receives a set of inputs.static classA logging driver that writes to a text file.static interfaceLogger interface for all log writing.static enumLogging levels.static classA standard logger for outputting to a print stream. -
Constructor Summary
ConstructorsConstructorDescriptionEngineLoggingFactory(EngineLoggingFactory.Driver... drivers) Creates a new logging factory.EngineLoggingFactory(EngineLoggingFactory.LogLevel level, EngineLoggingFactory.Driver... drivers) Creates a new logging factory. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDriver(EngineLoggingFactory.Driver... drivers) Adds a logging driver or drivers from this factory.static EngineLoggingFactory.LoggercreateConsoleLoggerFor(Class<?> clazz) A convenience method for creating a Console-appending logger for a particular source by class name.static EngineLoggingFactory.LoggercreateConsoleLoggerFor(Class<?> clazz, boolean fullyQualified) A convenience method for creating a Console-appending logger for a particular source by class name.static EngineLoggingFactory.LoggercreateConsoleLoggerFor(String name) A convenience method for creating a Console-appending logger for a particular source by name.static EngineLoggingFactoryA convenience method for creating a Console-appending logger factory.Creates a new Logger for outputting logs, using the name of the class as a source name.Creates a new Logger for outputting logs, using the name of the class as a source name.Creates a new Logger for outputting logs.Returns the current logging level.voidremoveDriver(EngineLoggingFactory.Driver... drivers) Removes a logging driver or drivers from this factory.voidReturns the current logging level.
-
Constructor Details
-
EngineLoggingFactory
Creates a new logging factory. The starting logging level isEngineLoggingFactory.LogLevel.DEBUG.- Parameters:
drivers- the logging driver to use for directing output.
-
EngineLoggingFactory
public EngineLoggingFactory(EngineLoggingFactory.LogLevel level, EngineLoggingFactory.Driver... drivers) Creates a new logging factory.- Parameters:
level- the starting logging level.drivers- the logging driver to use for directing output.
-
-
Method Details
-
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
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
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
Adds a logging driver or drivers from this factory.- Parameters:
drivers- the drivers to add.
-
removeDriver
Removes a logging driver or drivers from this factory.- Parameters:
drivers- the drivers to remove.
-
getLoggingLevel
Returns the current logging level. Anything logged usingEngineLoggingFactory.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
Returns the current logging level. Anything logged usingEngineLoggingFactory.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
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
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
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.
-