sharedLog

This property sets and gets the default Logger. Unless set to another logger by the user, the default logger's log level is LogLevel.info.

  1. shared(Logger) sharedLog [@property getter]
    @property @safe
    shared(Logger)
    sharedLog
    ()
  2. void sharedLog [@property getter]

Examples

sharedLog = new FileLogger(yourFile);

The example sets a new FileLogger as new sharedLog.

If at some point you want to use the original default logger again, you can use sharedLog = null;. This will put back the original.

Note: While getting and setting sharedLog is thread-safe, it has to be considered that the returned reference is only a current snapshot and in the following code, you must make sure no other thread reassigns to it between reading and writing sharedLog.

sharedLog is only thread-safe if the used Logger is thread-safe. The default Logger is thread-safe.

if (sharedLog !is myLogger)
    sharedLog = new myLogger;

Meta