phobos/std/experimental/logger/nulllogger.d
Robert burner Schadek d250e5cc26 Revert "Remove concurrency @trusted workarounds"
This reverts commit 299f0183e2661cb2640749a692a3463a0e51c1f9.

thread local forward

thread local default log function forward

nicer imports

forwardMsg must not be final

moved comments to package and started to integerade Martin's log disabling

more compile time function disabling

style and dscanner suggestions

stdThreadLog fix and doc

a lot of updates

* spell fixes
* better tests
* docu changes

docu update

whitespace

moduleLogLevel docu
2015-01-26 16:09:48 +01:00

36 lines
923 B
D

module std.experimental.logger.nulllogger;
import std.experimental.logger.core;
/** The $(D NullLogger) will not process any log messages.
In case of a log message with $(D LogLevel.fatal) nothing will happen.
*/
class NullLogger : Logger
{
/** The default constructor for the $(D NullLogger).
Independent of the parameter this Logger will never log a message.
Params:
lv = The $(D LogLevel) for the $(D NullLogger). By default the $(D LogLevel)
for $(D NullLogger) is $(D LogLevel.info).
*/
this(const LogLevel lv = LogLevel.info) @safe
{
super(lv);
this.fatalHandler = delegate() {};
}
override protected void writeLogMsg(ref LogEntry payload) @safe @nogc
{
}
}
///
@safe unittest
{
auto nl1 = new NullLogger(LogLevel.all);
nl1.info("You will never read this.");
nl1.fatal("You will never read this, either and it will not throw");
}