std.experimental.logger default log level is everything

Steven Schveighoffer schveiguy at gmail.com
Fri May 28 17:29:48 UTC 2021


This code outputs "tracing":

```d
void main()
{
     import std.experimental.logger;
     sharedLog.trace("tracing");
}
```

Why does this happen, because the default log level is `all`.

Why would this be a problem? Because if I'm writing a library, what I 
want to put into tracing is stuff like protocol packet contents, very, 
very fine grained checks/internal state, etc.

If someone uses my library, then they get tracing messages to stderr *by 
default*.

IMO, the default level should be either `off` (no logging) or `fatal`. I 
shouldn't see trace messages without opting in to logging.

It makes std.experimental.logger unusable inside a public library, or 
else I have to stick it behind a special dub configuration to enable it.

Thoughts?

-Steve


More information about the Digitalmars-d mailing list