sclogging package

Submodules

sclogging.sclogging_main module

Custom logging module with coloredlogs

class sclogging.sclogging_main.Timer(level: [<class 'str'>, <class 'int'>] = 'DEBUG')

Custom timer class

Level sets what level of debug the timer displays at

Parameters:

level ([<class 'str'>, <class 'int'>])

start_timer(note: str = '', show_process: bool = False)

Start timer

Parameters:
  • note (str) – Note for logger

  • show_process (bool) – Show process name in default message

Returns:

stop_timer(note: str = '', show_process: bool = False)

Stop timer

Use %t% to insert time in custom note

Parameters:
  • note (str) – Note for logger

  • show_process (bool) – Show process name in default message

Returns:

sclogging.sclogging_main.get_logger(caller_name: str = None, level: [<class 'str'>, <class 'int'>] = 'INFO', log_to_file: bool = False, log_file_level: [<class 'str'>, <class 'int'>] = 'WARNING') logging.Logger

Configures a logger

Parameters:
  • caller_name (str) – Name of module or custom name

  • level ([<class 'str'>, <class 'int'>]) – Debug level

  • log_to_file (bool) – Logs to file in path set by set_log_path

  • log_file_level ([<class 'str'>, <class 'int'>]) – Level for file if different from base level

Returns:

Logger

Return type:

logging.Logger

sclogging.sclogging_main.set_config(default_log_level: [<class 'str'>, <class 'int'>] = 'INFO', log_to_file: bool = False, log_file_level: [<class 'str'>, <class 'int'>] = 'WARNING', log_file_path: str = 'C:\\Logs', log_extension: str = 'log', display_spacer: str = '_', display_spacer_color: str = '\x1b[90m', specific_logger_levels: dict = {'selenium': 'WARNING', 'urllib3': 'WARNING', 'xhtml2pdf': 'WARNING'})

Sets default config

Parameters:
  • default_log_level ([<class 'str'>, <class 'int'>])

  • log_to_file (bool)

  • log_file_level ([<class 'str'>, <class 'int'>])

  • log_file_path (str)

  • log_extension (str)

  • display_spacer (str)

  • display_spacer_color (str)

  • specific_logger_levels (dict)

Returns: