Logging#

class PatcherLog[source]#
static setup_logger(name: str | None = None, level: int | None = 20, debug: bool = False) Logger[source]#

Configures and returns a logger. If the logger is already configured, it ensures no duplicate handlers.

Parameters:
  • name (Optional [str]) – Name of the logger, defaults to “Patcher”.

  • level (Optional [int]) – Logging level, defaults to INFO if not specified.

  • debug (bool) – Whether to enable debug logging for console, defaults to False.

Returns:

The configured logger.

Return type:

Logger

static setup_child_logger(childName: str, loggerName: str | None = None) Logger[source]#

Setup a child logger for a specified context.

Removed in version 2.0

The debug parameter is now handled at CLI entry point. Child loggers with an explicitly set logging level will not respect configuration changes to the root logger.

Parameters:
  • childName (str) – The name of the child logger.

  • loggerName (str) – The name of the parent logger, defaults to “Patcher”.

Returns:

The configured child logger.

Return type:

Logger

static custom_excepthook(exc_type: Type[BaseException], exc_value: BaseException, exc_traceback: TracebackType | None) None[source]#

A custom exception handler for unhandled exceptions.

This method is intended to be assigned to sys.excepthook to handle any uncaught exceptions in the application.

Parameters:
Return type:

None

class LogMe(class_name: str)[source]#

A wrapper class for logging with optional output to console using click.

Parameters:

class_name (str) – The name of the class for which the logger is being set up.

property is_debug: bool[source]#

Check if any logger handlers are set to debug level.