DefaultLoggerFactory

A basic LoggerFactory implementation that just creates a Logger with a handler and pre-set logging level. It also includes methods for defining custom logging levels for individual module patterns, so that you can, for example, only show debug messages from a single module.

Constructors

this
this(LogHandler handler, Level rootLoggingLevel)

Constructs the factory with the given handler, and optionally a root logging level.

Members

Functions

getLogger
Logger getLogger(string name)

Gets a Logger. The Logger's level is set according to the root logging level, unless there exists a module-specific level that was set via setModuleLevel.

setModuleLevel
void setModuleLevel(string modulePattern, Level level)

Sets the logging level for a given module pattern regular expression. When this factory prepares a logger for a given module (or logger name if the developer has defined a custom name), it will give that logger a logging level according to the configured rootLoggingLevel of this factory. Then, if it finds a module pattern set using this function, it will use the declared level instead. Module patterns are searched in the order that they're defined.

setModuleLevelPrefix
void setModuleLevelPrefix(string modulePrefix, Level level)

Sets the logging level for a given module prefix. This is a convenience wrapper around setModuleLevel, which simply prepares a regular expression that matches the beginning of a logger's module (or name) with the given modulePrefix.

setRootLevel
void setRootLevel(Level level)

Sets the root logging level for this factory.

Inherited Members

From LoggerFactory

getLogger
Logger getLogger(string name)

Gets a logger.