decent_bench.utils.logger#

decent_bench.utils.logger.LOGGER#

Logger to be used across the codebase.

class decent_bench.utils.logger.LogQueue(*args, **kwargs)[source]#

Bases: Protocol

A minimal protocol for queue-like objects used by logging handlers.

abstractmethod put_nowait(item: LogRecord, /) None[source]#

Put item.

abstractmethod get() LogRecord[source]#

Get item.

decent_bench.utils.logger.start_logger(log_level: int = logging.INFO) None[source]#

Configure the logger for single-process use.

Use this function when you don’t need multiprocessing support (e.g., when calling display_metrics or compute_metrics directly). For multiprocessing contexts, use start_log_listener and start_queue_logger instead.

Parameters:

log_level – minimum level to log, e.g. logging.INFO

Note

Filtering is done at the logger level (not handler level) for consistency. The logger level controls what messages are processed, and the handler inherits this by using NOTSET (the default).

decent_bench.utils.logger.start_log_listener(manager: SyncManager, log_level: int) QueueListener[source]#

Start listener thread which can receive log messages through a queue.

Parameters:
  • manager – used to create a log queue that can be shared across processes

  • log_level – minimum level to log, e.g. logging.INFO

Returns:

QueueListener which can be used to access the log queue and to stop the listener thread

Note

For multiprocessing, filtering is done at the handler level (not logger level). Worker processes use start_queue_logger which sets LOGGER to NOTSET, allowing all messages to be sent to the queue. The RichHandler on the listener filters messages based on log_level.

decent_bench.utils.logger.start_queue_logger(queue: LogQueue) None[source]#

Configure the default logger for the current process to put log messages in the queue.

Note

Sets LOGGER level to NOTSET so all messages are sent to the queue regardless of level. Filtering happens on the listener side via the handler’s level setting.