stdThreadLocalLog

This function returns a thread unique Logger, that by default propergates all data logged to it to the sharedLog.

These properties can be used to set and get this Logger. Every modification to this Logger will only be visible in the thread the modification has been done from.

This Logger is called by the free standing log functions. This allows to create thread local redirections and still use the free standing log functions.

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

Examples

Ditto

import std.experimental.logger.filelogger : FileLogger;
import std.file : deleteme, remove;
Logger l = stdThreadLocalLog;
stdThreadLocalLog = new FileLogger(deleteme ~ "-someFile.log");
scope(exit) remove(deleteme ~ "-someFile.log");

auto tempLog = stdThreadLocalLog;
stdThreadLocalLog = l;
destroy(tempLog);

Meta

Suggestion Box / Bug Report