Logging#
- setup_logger(log_name: str | None = 'Patcher', log_filename: str | None = 'Patcher.log', log_level: int | None = 20) Logger [source]#
Set up the main logger with rotating file handler.
- Parameters:
- Returns:
The configured logger.
- Return type:
- setup_child_logger(name_of_child: str, name_of_logger: str | None = 'Patcher', debug: bool | None = False) Logger [source]#
Setup a child logger for a specified context.
- Parameters:
- Returns:
The configured child logger.
- Return type:
- handle_traceback(exception: Exception)[source]#
Write tracebacks to logs instead of to console for readability purposes.
- Parameters:
exception (Exception) – The exception instance to log.
- class LogMe(class_name: str, debug: bool | None = False)[source]#
A wrapper class for logging with additional output to console using click.
- Parameters:
- is_debug_enabled() bool [source]#
Check if debug logging is enabled.
- Returns:
True if debug logging is enabled, False otherwise.
- Return type:
- debug(msg: str)[source]#
Log a debug message and output to console if debug is enabled.
- Parameters:
msg (str) – The debug message to log.
- info(msg: str)[source]#
Log an info message and output to console.
- Parameters:
msg (str) – The info message to log.