OCDocker.Toolbox.Logging module¶
Logging wrapper that bridges OCDocker logging to Python’s logging.
Usage:
import OCDocker.Toolbox.Logging as oclogging
- OCDocker.Toolbox.Logging.backup_log(logname)[source]¶
Backup the current log under <logdir>/read_log_past.
- Parameters:
logname (str) – The base name of the log file (without .log extension).
- Return type:
None
- OCDocker.Toolbox.Logging.clear_past_logs()[source]¶
Clear past logs under the default log directory/past folders.
- Return type:
None
- OCDocker.Toolbox.Logging.configure(level=None, log_file=None, to_stdout=True, use_rich=None)[source]¶
Configure the root ocdocker logger.
- Parameters:
level (Optional[ocerror.ReportLevel], optional) – The report level to set. If None, uses current ocerror level.
log_file (Optional[str], optional) – Path to a log file to add as a handler. If None, no file logging is added.
to_stdout (bool, optional) – Whether to direct console output to stdout (True) or stderr (False).
use_rich (Optional[bool], optional) – Whether to attempt Rich handler creation. If None, keep prior choice.
- Return type:
None
- OCDocker.Toolbox.Logging.get_logger(name=None)[source]¶
Return the configured logger (or a child).
- Parameters:
name (Optional[str], optional) – Name of the child logger to return. If None, returns the root logger.
- Returns:
The requested logger instance.
- Return type:
logging.Logger