csle_common.logging package

Submodules

csle_common.logging.custom_formatter module

class csle_common.logging.custom_formatter.CustomFormatter(fmt=None, datefmt=None, style='%', validate=True)[source]

Bases: logging.Formatter

Custom formatter for DEBUG-logging.

Custom Formatter does these 2 things: 1. Overrides ‘funcName’ with the value of ‘func_name_override’, if it exists. 2. Overrides ‘filename’ with the value of ‘file_name_override’, if it exists.

format(record) str[source]

Formats a given record

Parameters

record – the record to format

Returns

the formatted string

csle_common.logging.log module

class csle_common.logging.log.Logger(*args, **kwargs)[source]

Bases: object

Centralized class that handles log-management in csle

get_log_file_path() str[source]
Returns

the path where the log file is stored

get_logger() logging.Logger[source]
Returns

the CSLE logger

setup_logfile(log_path, logger) None[source]

Sets up the log file

Parameters
  • log_path – the path to the log file

  • logger – the logger object

Returns

None

class csle_common.logging.log.SingletonType[source]

Bases: type

Singleton type class

csle_common.logging.log.handle_exception(exc_type, exc_value, exc_traceback) None[source]

Utility function for handling a given exception

Parameters
  • exc_type – the type of the exception

  • exc_value – the value of the exception

  • exc_traceback – the traceback of the exception

Returns

None

Module contents