| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Blammo.Logging.LogSettings.LogLevels
Description
Backwards-compatible extension to a simple LogLevel parser/filter
Assume you are using this library/module to parse a LOG_LEVEL environment
variable, which is used to filter your logs.
Running,
LOG_LEVEL=warn ./my-program
Will do what you expect: filter all logging to only those messages
at-or-above warn level.
While,
LOG_LEVEL=debug ./my-program
Will enable debug logging throughout.
This is all un-surprising and this module does not change behavior in this case whatsoever. But let's say that is entirely too noisy. Because you're using Amazonka and persistent, and have correctly integrated your main logging with them, you are now getting tons of spam from their very-chatty debug logs, and its drowning out the application debug logs you were hoping to see.
Well, now can do this:
LOG_LEVEL="debug,Amazonka:info,SQL:warn" ./my-program
And suddenly your application's debug logs are standing out again, because everything from the Amazonka source is filtered to info and the SQL source is filtered to warn.
The format parsed by readLogLevels is:
[source:level, ...,]level[, source:level, ...]
Where level defines the minimum level for anything not overridden by
source. If you go on to add any source:level pairs, that will change the
minimum level for messages from that source.