std.experimental.logger default log level is everything

Steven Schveighoffer schveiguy at gmail.com
Mon May 31 16:46:35 UTC 2021


On 5/31/21 5:03 AM, Robert Schadek wrote:
> On Monday, 31 May 2021 at 00:42:50 UTC, Mathias LANG wrote:
>> On Friday, 28 May 2021 at 17:29:48 UTC, Steven Schveighoffer wrote:
>>> [...]
>>>
>>> IMO, the default level should be either `off` (no logging) or 
>>> `fatal`. I shouldn't see trace messages without opting in to logging.
> 
> The amount of bug reports that lib would have gotten if it were off be 
> default
> would properly be very large.

I disagree completely. When people want to use something, they look at 
how to use it, and use it. If they use it wrong because they didn't read 
the directions, they *might* file a bug report, and if they do, you just 
post a RTFM response and move on. Most likely they post a message to 
d.learn and learn (or look it up on stack overflow or whatnot).

> 
> To be frank, I would assume everybody replying to this thread, would 
> have made
> a better job implementing a logger than I did all that time back, would 
> be able to
> read the docs and insert a:
> 
> ```D
> void main() {
>      globalLogLevel = LogLevel.off;
> }
> ```

If someone does:

```d
// note no import of std.experimental.logger
main() {
    libraryFunction();
}
```

And gets log messages they didn't ask for, I think that would generate 
far more bug reports. Maybe not for logger, but for the poor library 
that decided to use it, as it likely has its name printing out with the 
log messages. And closing those bug reports with "you have to configure 
the logger away from the default" would not be met with blanket acceptance.

The end result here is: no library is going to use it (including mine).

-Steve


More information about the Digitalmars-d mailing list