obvs.logging
Logging Module
This module provides utility functions and classes for configuring and customizing the logging behavior in the application.
The main features of this module include:
TqdmLoggingHandler: A custom logging handler that integrates with the tqdm progress bar library. It allows log messages to be displayed alongside the progress bar without interfering with its output.
set_tqdm_logging: A function that sets up the logging system to use the TqdmLoggingHandler for all loggers, excluding specified loggers. This function ensures that log messages are properly displayed with the tqdm progress bar.
Custom logger configuration: The module configures a specific logger named “patchscope” with a file handler that logs messages to a file named “experiments.log”. This logger is set to not propagate messages to the root logger, ensuring that only the desired messages are logged to the file.
Module Contents
Classes
Handler instances dispatch logging events to specific destinations. |
Functions
|
Attributes
- class obvs.logging.TqdmLoggingHandler
Bases:
logging.HandlerHandler instances dispatch logging events to specific destinations.
The base handler class. Acts as a placeholder which defines the Handler interface. Handlers can optionally use Formatter instances to format records as desired. By default, no formatter is specified; in this case, the ‘raw’ message as determined by record.message is logged.
- emit(record)
Do whatever it takes to actually log the specified logging record.
This version is intended to be implemented by subclasses and so raises a NotImplementedError.
- obvs.logging.set_tqdm_logging(exclude_loggers=None)
- obvs.logging.logger
- obvs.logging.file_handler
- obvs.logging.file_formatter