Fortran: Fix PR 47485.
[gcc.git] / libphobos / src / std / logger / nulllogger.d
blobfd48b8529bb00c5f172d6b4aaf8a561d4d6e8021
1 // Written in the D programming language.
2 /**
3 Source: $(PHOBOSSRC std/logger/nulllogger.d)
4 */
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.
19 Params:
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
25 super(lv);
26 this.fatalHandler = delegate() {};
29 override protected void writeLogMsg(ref LogEntry payload) @safe @nogc
34 ///
35 @safe unittest
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");