onsrap.logger module¶
- class onsrap.logger.LogConfig(log_dir: str = 'logs/', log_level: str = 'INFO', logger_name: str = 'onsrap')¶
Bases:
objectData class which holds information regarding how the logs are set up.
- Parameters:
log_dir (str, default = "logs/") – The directory where all logs are stored for the Pipeline.
log_level (str, default = "INFO") – Denotes how severe the log message is.
logger_name (str, default = "onsrap") – The name of the logging system.
- log_dir: str = 'logs/'¶
- log_level: str = 'INFO'¶
- logger_name: str = 'onsrap'¶
- class onsrap.logger.Logger(log_dir: str | Path = 'logs/', log_level: str = 'INFO')¶
Bases:
objectCreates a logging system.
This system creates a logging directory and enables writing the log messages to both console and the logging files. It allows configurable logging levels to adjust for severity and avoids duplicating logging messages or handlers. If the logger is unable to write to a file, the logging continues using only the console handler.
- Parameters:
log_dir (str or Path, default = "logs/") – The directory where you’d like your logs stored.
log_level (str, default = "INFO") – The severity of the log.
- event(message: str, **kwargs: Any) None¶
Logs a named event with optional structured context.
- Parameters:
message (str) – The main description of the event to be logged.
**kwargs (Any) – Additional information to be recorded in the log record.
- extract_historical_run_ids(run_root: Path, name: str) list[dict[str, Any]]¶
Extracts historical run IDs from the log files.
- Parameters:
run_root (Path) – The root directory where the historical runs are stored.
name (str) – The name of the pipeline for which to extract historical run IDs.
- Returns:
A list of dictionaries containing run_id, timestamp, and run_dir for each historical run.
- Return type:
list[dict[str, Any]]
- warning(message: str, **kwargs: Any) None¶
Logs a warning message with optional structured context.
- Parameters:
message (str) – The main description of the warning to be logged.
**kwargs (Any) – Additional information to be recorded in the log record.