View source code
Display the source code in std/experimental/logger/core.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Function std.experimental.logger.core.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.
Example
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;
Authors
License
Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.