The severity is called warning but Log calls are warn. This is already causing me confusion and I assume others will have the same issue. I recommend changing warning to the shorter name.
Code:
Log.warn { ... }
Command line:
export LOG_LEVEL=warn
./example
Unhandled exception: Unknown enum Log::Severity value: WARN (ArgumentError)
Crystal 0.35-dev
I tried to make Log::Severity.parse accept "warn" as an alternative for Warning value, but the Enum.parse didn't allow redefining it. Something with the returning : self restriction. Clearly we can add another method for parsing at least.
I choose warn for the method to use it as a verb. But using a verb to indicate the severity seemed wrong.
So I would suggest adding flexibility on parsing with some method, but leave the severity and method names as is. That seems to fix the source of the confusion. We are still allowing case insensitive parsing, so it's not that we are requiring 100% match of the method name / severity / configuration.
I choose
warnfor the method to use it as a verb. But using a verb to indicate the severity seemed wrong.
What's a "debug"?
Most other methods are not verb: .info , .error, .debug.
Using .warning like in Python is consistent.
Consider warn shorthand for warning and the language problem disappears.
Ruby: Severity. Constants are defined in Logger namespace: DEBUG, INFO, WARN, ERROR, FATAL, or UNKNOWN.
Rust env_logger: The actual level is optional to specify. If omitted, all logging will be enabled. If specified, it must be one of the strings debug, error, info, warn, or trace.
Nim logger: Warn - impending problems that require some attention
C# log4net: Levels are instances of the log4net.Core.Level class. The following levels are defined in order of increasing priority: ALL DEBUG INFO WARN ERROR FATAL OFF
My wrists hurt. Shortening it causes no harm unlike the extra key strokes.
Most helpful comment
Consider
warnshorthand forwarningand the language problem disappears.Ruby:
Severity. Constants are defined in Logger namespace: DEBUG, INFO, WARN, ERROR, FATAL, or UNKNOWN.Rust env_logger:
The actual level is optional to specify. If omitted, all logging will be enabled. If specified, it must be one of the strings debug, error, info, warn, or trace.Nim logger:
Warn - impending problems that require some attentionC# log4net:
Levels are instances of the log4net.Core.Level class. The following levels are defined in order of increasing priority: ALL DEBUG INFO WARN ERROR FATAL OFFMy wrists hurt. Shortening it causes no harm unlike the extra key strokes.