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:
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:
log_info(message)[source]

Log INFO message, and return its time.

Parameters:message (string) – the message to log
Return type:datetime
log_warn(message)[source]

Log WARNING message, and return its time.

Parameters:message (string) – the message to log
Return type:datetime
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'

CRITICAL severity

DEBUG = 'DEBU'

DEBUG severity

ERROR = 'ERRO'

ERROR message

INFO = 'INFO'

INFO severity

SUCCESS = 'SUCC'

SUCCESS message

WARNING = 'WARN'

WARNING severity

clear()[source]

Clear the contents of the log.

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

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
write(path)[source]

Output the log to file.

Parameters:path (string) – the path of the log file to be written