How to use isLoggingEnabled?

Andre Pany andre at
Mon Sep 21 11:21:53 UTC 2020


I am confused by the description of isLoggingEnabled.

In my unittest version I want to disable logging and use this 
``` d
sharedLog = new NullLogger(;

If have some stdout writeln coding (to avoid the timestamp / 
module prefix):

``` d
private void printRuntimeLog(string logFilePath)
     import std.stdio : stdout;

     if (isLoggingEnabled(
     {!(line => 
"[runtime-log] " ~ line).each!(line => stdout.writeln(line));

I just want to check whether or more is active. But 
the method isLoggingEnabled seems to expect the LogLevel 3 times?

@safe bool isLoggingEnabled()(LogLevel ll, LogLevel loggerLL, 
LogLevel globalLL, lazy bool condition = true);

Another strange thing is, the description of isLogginEnabled 
( mentions a call with only 1 logLevel argument, but this method does not seems to exist:

> pure bool isLoggingEnabled()(LogLevel ll) @safe nothrow @nogc

Is there an easy way to check if log level is "info" or more?

Kind regards

More information about the Digitalmars-d-learn mailing list