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. |
Using Logger
To use the logger, just import it and set a log level:
>>> from astropop.logger import logger
>>> logger.setLevel('WARN')
You are now read to print simple logging:
>>> logger.error('Matrix error. Agents needeed.')
ERROR: Matrix error. Agents needeed. [unknown]
The general behavior of Astropop logger is the same of Python default logger, very well documentated in Python Log docs.