xai4tsc.logging_config

Public logging controls for the xai4tsc package.

By default the package is silent: xai4tsc installs only a logging.NullHandler on the 'xai4tsc' logger. Call enable_logging() to attach a console handler (and, optionally, a file handler) and disable_logging() to return the package to its silent default. Both target the 'xai4tsc' named logger only and never touch the root logger, so enabling logging here does not affect the host application’s own logging configuration. More sinks are plain logging handlers added to logging.getLogger("xai4tsc").

Functions

enable_logging(→ logging.Logger)

Enable logging for the xai4tsc package.

disable_logging(→ None)

Disable xai4tsc logging and restore the silent-by-default state.

Module Contents

xai4tsc.logging_config.enable_logging(destination: str | pathlib.Path | None = None, level: int | str = 'INFO') → logging.Logger

Enable logging for the xai4tsc package.

Attaches one console (stdout) handler to the 'xai4tsc' logger and, when destination is given, one file handler. Each call replaces the handlers a previous call attached, so repeated calls never duplicate output; handlers added by other code are left alone. Only the 'xai4tsc' logger is configured; the root logger is left untouched.

Parameters:
  • destination (str or pathlib.Path, optional) – Log file to write to as well. Missing parent directories are created and an existing file is overwritten. If None (default), only console logging is enabled.

  • level (int or str, default="INFO") – Logging level as a name (e.g. "DEBUG") or a numeric value (e.g. logging.WARNING). At DEBUG the logger name is included in the log format.

Returns:

The configured 'xai4tsc' logger.

Return type:

logging.Logger

xai4tsc.logging_config.disable_logging() → None

Disable xai4tsc logging and restore the silent-by-default state.

Removes every handler installed by enable_logging() (leaving the library’s logging.NullHandler in place) and resets the 'xai4tsc' logger’s level and propagation to their defaults.