swamp.logger.swamplogger module¶
-
class
SwampLogger
(name, silent=False, *args, **kwargs)[source]¶ Bases:
logging.Logger
Class that implements methods to assist with SWAMP logging messages.
Parameters: Variables: msg_record (list) – a list with all the messaged recorded into the log (even if silent is set to True)
-
debug
(msg, *args, **kwargs)[source]¶ Extend
logging.Logger.debug()
to check ifsilent
and and format the message
-
error
(msg, *args, **kwargs)[source]¶ Extend
logging.Logger.error()
to include theerror_header
, check ifsilent
and format the message
-
error_header
¶ Header to highlight error messages
-
greeting_msg
¶ A greeting message to appear when the logger initiates, informs of the current time and SWAMP version
-
info
(msg, *args, **kwargs)[source]¶ Extend
logging.Logger.info()
to check ifsilent
and and format the message
-
init
(console_level='info', logfile_level='debug', logfile=None, use_console=True)[source]¶ Method to initiate the
SwampLogger
Parameters: - console_level (str) – indicate the console logging level (default: ‘info’)
- logfile_level (str) – indicate the logfile logging level (default: ‘debug’)
- logfile (str) – file name to create a log file (default: None)
- use_console (bool) – indicate whether or not to use the console while logging (default: True)
-
logging_levels
¶ A dictionary with the different logger levels that can be set
-
msg
¶ Property to be used as the format for logged messages
-
now
¶ Current time
-
record
¶ Named tuple to be used as a template for the records stored at
msg_record
-