logger

Logger implementations for the coding experiments library.

This module provides concrete implementations of the TransmissionLogger protocol for logging transmission events with different storage and output strategies.

class codinglab.logger.PlainLogger[source]

Bases: TransmissionLogger

Simple logger that stores all log entries in memory.

This logger maintains an in-memory list of all transmission logs, which can be accessed later for analysis or debugging.

__init__()[source]

Initialize an empty PlainLogger.

Return type:

None

logs: List[TransmissionLog]

List of all logged transmission entries.

log(log_entry)[source]

Store a transmission log entry in memory.

Parameters:

log_entry (TransmissionLog) – The transmission log entry to record

Return type:

None

class codinglab.logger.ConsoleLogger(verbose=True)[source]

Bases: TransmissionLogger

Logger that prints log entries to the console.

This logger outputs transmission events to standard output, making it useful for real-time monitoring and debugging.

Parameters:

verbose (bool)

__init__(verbose=True)[source]

Initialize a ConsoleLogger.

Parameters:

verbose (bool) – Whether to print detailed log information

Return type:

None

verbose

Verbosity setting for log output.

log(log_entry)[source]

Print a transmission log entry to the console.

Parameters:

log_entry (TransmissionLog) – The transmission log entry to print

Return type:

None

class codinglab.logger.NullLogger[source]

Bases: TransmissionLogger

Logger that discards all log entries (no-op).

This logger implements the TransmissionLogger protocol but performs no actual logging. It’s useful for performance optimization when logging is not required.

__init__()[source]

Initialize a NullLogger.

Return type:

None

log(log_entry)[source]

Discard a transmission log entry (no operation).

Parameters:

log_entry (TransmissionLog) – The transmission log entry to discard

Return type:

None