Support different logging levels
jamebs opened this issue · 1 comments
jamebs commented
What?
We would like to be able to use MAGDA Loggers to print warnings, errors and debug information.
Why?
To make logs more readable.
How?
- By adding a new formatter showing the log level, e.g.:
[2021-08-16 12:05:14.366] [INFO] ParallelPipeline (Example) ModuleA (m1:g2) [BOOTSTRAP]
[2021-08-16 12:05:16.641] [WARNING] ParallelPipeline (Example) ModuleA (m1:g2) Missing parameter "a" - using default value "None"
Different colors for the above formatter and messages (last part) should be used at different levels.
2. By adding new methods for a logger: debug()
, warning()
, error()
and critical()
printing at specific level
jamebs commented
The log level will be visible as a separate "part". However, this part should be hidden when using output=MagdaConfig.Output.Logging
. The standard python logging already shows its level. Just remember, to use a proper method (currently, all logs are written with logging.getLoger("magda.runtime").info
).