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:

DEBUG

10

Diagnostic informations. Very verbose level.

INFO

20

Important diagnostic informations. Low verbosity level.

WARNING

30

Something is possibly wrong, but not a properly error.

ERROR

40

Error.

CRITICAL

50

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#

log_to_list(logger[, log_list, full_record])

Add a ListHandler and a log_list to a Logger.

resolve_level_string(value)

Resolve the log level of a string.

Classes#

ListHandler([log_list, full_record])

Logging handler to save messages in a list.