1 // Written in the D programming language.
3 Source: $(PHOBOSSRC std/logger/nulllogger.d)
5 module std
.logger
.nulllogger
;
7 import std
.logger
.core
;
9 /** The `NullLogger` will not process any log messages.
11 In case of a log message with `LogLevel.fatal` nothing will happen.
13 class NullLogger
: Logger
15 /** The default constructor for the `NullLogger`.
17 Independent of the parameter this Logger will never log a message.
20 lv = The `LogLevel` for the `NullLogger`. By default the `LogLevel`
21 for `NullLogger` is `LogLevel.all`.
23 this(const LogLevel lv
= LogLevel
.all
) @safe
26 this.fatalHandler
= delegate() {};
29 override protected void writeLogMsg(ref LogEntry payload
) @safe @nogc
37 import std
.logger
.core
: LogLevel
;
38 auto nl1
= new NullLogger(LogLevel
.all
);
39 nl1
.info("You will never read this.");
40 nl1
.fatal("You will never read this, either and it will not throw");