logger¶
This module contains the following classes:
Loggable, a base class supporting logging and runtime configuration;Logger, a logger class for debugging and performance profiling.
-
class
aeneas.logger.Loggable(logger=None, rconf=None)[source]¶ A base class supporting logging and runtime configuration.
Parameters: - logger (
Logger) – the logger object - rconf (
RuntimeConfiguration) – the runtime configuration object
-
log(message)[source]¶ Log DEBUG message, and return its time.
Parameters: message (string) – the message to log Return type: datetime
-
log_crit(message)[source]¶ Log CRITICAL message, and return its time.
Parameters: message (string) – the message to log Return type: datetime
-
log_exc(message, exc=None, critical=True, raise_type=None)[source]¶ Log exception, and possibly raise exception.
Parameters: - message (string) – the message to log
- exc (Exception) – the original exception
- critical (bool) – if
True, log asaeneas.logger.Logger.CRITICAL; otherwise asaeneas.logger.Logger.WARNING - raise_type (Exception) – if not
None, raise this Exception type
- logger (
-
class
aeneas.logger.Logger(tee=False, indentation=0, tee_show_datetime=True)[source]¶ A logger class for debugging and performance profiling.
Parameters: - tee (bool) – if
True, tee (i.e., log and print to stdout) - indentation (int) – the initial indentation of the log
- tee_show_datetime (bool) – if
True, print date and time when teeing
-
CRITICAL= 'CRIT'¶ CRITICALseverity
-
DEBUG= 'DEBU'¶ DEBUGseverity
-
ERROR= 'ERRO'¶ ERRORmessage
-
INFO= 'INFO'¶ INFOseverity
-
SUCCESS= 'SUCC'¶ SUCCESSmessage
-
WARNING= 'WARN'¶ WARNINGseverity
-
indentation¶ The current indentation of the log. Useful to visually distinguish log levels.
Return type: int
-
log(message, severity='INFO', tag='')[source]¶ Add a given message to the log, and return its time.
Parameters: - message (string) – the message to be added
- severity (
Logger) – the severity of the message - tag (string) – the tag associated with the message; usually, the name of the class generating the entry
Return type: datetime
-
pretty_print(as_list=False, show_datetime=True)[source]¶ Return a Unicode string pretty print of the log entries.
Parameters: - as_list (bool) – if
True, return a list of Unicode strings, one for each entry, instead of a Unicode string - show_datetime (bool) – if
True, show the date and time of the entries
Return type: string or list of strings
- as_list (bool) – if
-
tee¶ If
True, tee (i.e., log and print to stdout).Return type: bool
-
tee_show_datetime¶ If
True, print date and time when teeing.Return type: bool
- tee (bool) – if