Bug 22532 – std.experimental.logger Change default log level to LogLevel.warning, or LogLevel.off

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-11-21T19:43:25Z
Last change time
2022-01-07T08:32:37Z
Keywords
pull
Assigned to
Atila Neves
Creator
Steven Schveighoffer
Blocks
18857
See also
https://issues.dlang.org/show_bug.cgi?id=18857

Comments

Comment #0 by schveiguy — 2021-11-21T19:43:25Z
consider a library which wants to provide tracing outputs when using std.experimental.logger. LogLevel.trace is quite high density, which might log e.g. the contents of every packet received or sent. However, the default log level is LogLevel.all. This means that an application that isn't doing anything with logging gets a huge wall of text to stderr by including said library. This is a non-starter, a library cannot use std.experimental.logger. The default level should probably be `off` or `warning`. Just using a library should not mean opting into trace output. For reference: https://forum.dlang.org/post/[email protected] https://github.com/mysql-d/mysql-native/pull/187#issuecomment-850554936
Comment #1 by robertschadek — 2021-11-21T20:04:19Z
My opinion is the complete opposite. By default no log message should be stopped from being logged. When you log for the first time and your message does not appear, you will think it is broken. When you reach a level where too many log messages is your problem you will know how to change it.
Comment #2 by schveiguy — 2021-11-22T00:56:32Z
When you don't log anything, and pages of low-level data is spewed to the screen, I think you will more likely think that the library is broken. There is no reasonable link between "I included some dub library" and "you have to set the log level to avoid insane amounts of output". On the other hand, if you are trying to use the logging facilities, you are already looking at the documentation, and already willing to follow instructions. If you try logging something and it doesn't work, you go back to the already-open doc window, and read about why it didn't work. The fact remains, no library will use logger because of the default verbosity, including mysql-native.
Comment #3 by robertschadek — 2021-11-22T07:10:42Z
> The fact remains, no library will use logger because of the default verbosity, including mysql-native. I do not consider that to be a fact, but an opinion, at best a proof-by-one-example. mysql-native of course being a developed by you. > When you don't log anything, and pages of low-level data is spewed to the screen, I think you will more likely think that the library is broken. I totally disagree, when I include a logging library and it does show me anything, it is totally broken. > On the other hand, if you are trying to use the logging facilities, you are already looking at the documentation, and already willing to follow instructions. If you try logging something and it doesn't work, you go back to the already-open doc window, and read about why it didn't work. This argument can be made for the opposite as well. IMO we two can not resolve this discussion, clearly you think you are right and clearly I think I'm right. If there is ever a push for stuff out of std.experimental to be moved into std, the default loglevel should be decided by whoever is in charge of phobos at the time.
Comment #4 by dlang-bot — 2021-12-14T15:48:30Z
@atilaneves created dlang/phobos pull request #8336 "Fix issue 22532 - change default log level to LogLevel.warning" fixing this issue: - Fix issue 22532 - change default log level to LogLevel.warning https://github.com/dlang/phobos/pull/8336
Comment #5 by dlang-bot — 2022-01-07T08:32:37Z
dlang/phobos pull request #8336 "Fix issue 22532 - change default log level to LogLevel.warning" was merged into master: - 38a8bcbc04e9718b1012762e9317be1d4071984f by Atila Neves: Fix issue 22532 - change default log level to LogLevel.warning https://github.com/dlang/phobos/pull/8336