odatse.util.logger module

class odatse.util.logger.Logger(info: Info | None = None, *, buffer_size: int = 0, filename: str = 'runner.log', write_input: bool = False, write_result: bool = False, params: Dict[str, Any] | None = None, **rest)[source]

Bases: object

Logger class to handle logging of calls, elapsed time, and optionally input and result data.

Initialize the Logger.

Parameters:
  • info (Info, optional) – Information object containing logging parameters.

  • buffer_size (int) – Size of the buffer before writing to the log file.

  • filename (str) – Name of the log file.

  • write_input (bool) – Flag to indicate if input should be logged.

  • write_result (bool) – Flag to indicate if result should be logged.

  • params (Dict[str,Any]], optional) – Additional parameters for logging.

  • **rest – Additional keyword arguments.

__init__(info: Info | None = None, *, buffer_size: int = 0, filename: str = 'runner.log', write_input: bool = False, write_result: bool = False, params: Dict[str, Any] | None = None, **rest) None[source]

Initialize the Logger.

Parameters:
  • info (Info, optional) – Information object containing logging parameters.

  • buffer_size (int) – Size of the buffer before writing to the log file.

  • filename (str) – Name of the log file.

  • write_input (bool) – Flag to indicate if input should be logged.

  • write_result (bool) – Flag to indicate if result should be logged.

  • params (Dict[str,Any]], optional) – Additional parameters for logging.

  • **rest – Additional keyword arguments.

count(x: ndarray, args, result: float) None[source]

Log a call with input and result data.

Parameters:
  • x (np.ndarray) – Input data.

  • args – Additional arguments.

  • result (float) – Result data.

is_active() bool[source]

Check if logging is active.

Returns:

True if logging is active, False otherwise.

Return type:

bool

prepare(proc_dir: Path) None[source]

Prepare the log file for writing.

Parameters:

proc_dir (Path) – Directory where the log file will be created.

write() None[source]

Write the buffered log entries to the log file.