sharedLog

This property sets and gets the default Logger.

  1. Logger sharedLog [@property getter]
    @property @safe
    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 the used Logger is thread-safe. The default Logger is thread-safe.

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

Meta

Suggestion Box / Bug Report