Logging System#
Astropop has its own logger, with special abillities, by default.
It hierits Python’s default logger module (not Astropy’s one), due to bugs found in Astropy. It allows multiple childres, like for pipeline products, and have the special abillity to log to a list, for after use.
Using logger are far recommended over simple print
funtions, due to level filtering, storing, properly displaying, etc. The log levels are:
|
|
Diagnostic informations. Very verbose level. |
|
|
Important diagnostic informations. Low verbosity level. |
|
|
Something is possibly wrong, but not a properly error. |
|
|
Error. |
|
|
Very serious error. |
The function resolve_level_string
can be used to convert a string to an integer log level.
Using Logger#
To use the logger, just import it and set a log level:
In [1]: from astropop.logger import logger
In [2]: logger.setLevel('WARN')
You are now read to print simple logging:
In [3]: logger.error('Matrix error. Agents needeed.')
The general behavior of Astropop logger is the same of Python default logger, very well documentated in Python Log docs.
Todo
log_to_list doc
astropop.logger Module#
Functions#
|
Add a ListHandler and a log_list to a Logger. |
|
Resolve the log level of a string. |
Classes#
|
Logging handler to save messages in a list. |