nirs4all.core.logging.events module
Event types and structured logging for nirs4all.
This module defines event categories and structured event types used for consistent logging throughout the pipeline execution.
- class nirs4all.core.logging.events.EventType(value)[source]
Bases:
StrEnumEvent types within phases.
- ARTIFACT = 'artifact'
- BRANCH_COMPARE = 'branch_compare'
- BRANCH_ENTER = 'branch_enter'
- BRANCH_EXIT = 'branch_exit'
- BUILD = 'build'
- COLLECT = 'collect'
- COMPLETE = 'complete'
- CONFIG_LOAD = 'config_load'
- DEDUPLICATE = 'deduplicate'
- ENVIRONMENT = 'environment'
- ERROR = 'error'
- EXPAND = 'expand'
- LEAKAGE_CHECK = 'leakage_check'
- LOAD = 'load'
- METRIC = 'metric'
- MODEL = 'model'
- PREDICTIONS = 'predictions'
- PROGRESS = 'progress'
- PRUNE = 'prune'
- REPORT = 'report'
- SKIP = 'skip'
- SOURCE_CONCAT = 'source_concat'
- SOURCE_PROCESS = 'source_process'
- START = 'start'
- STEP = 'step'
- TRAIN_META = 'train_meta'
- TRANSFORM = 'transform'
- VALIDATE = 'validate'
- WARNING = 'warning'
- class nirs4all.core.logging.events.LogEvent(timestamp: datetime, level: str, phase: Phase | None, event_type: EventType, message: str, run_id: str | None = None, status: Status | None = None, branch_name: str | None = None, branch_path: list[str] | None = None, branch_index: int | None = None, source_index: int | None = None, source_name: str | None = None, duration_ms: float | None = None, metrics: dict[str, ~typing.Any]=<factory>, extra: dict[str, ~typing.Any]=<factory>)[source]
Bases:
objectStructured log event for machine-readable logging.
- Variables:
timestamp (datetime.datetime) – Event timestamp.
level (str) – Log level (INFO, DEBUG, WARNING, ERROR).
phase (nirs4all.core.logging.events.Phase | None) – Current workflow phase.
event_type (nirs4all.core.logging.events.EventType) – Type of event within the phase.
message (str) – Human-readable message.
run_id (str | None) – Unique run identifier.
status (nirs4all.core.logging.events.Status | None) – Event status indicator.
branch_name (str | None) – Current branch name (if in branch context).
branch_path (list[str] | None) – Full branch path for nested branches.
branch_index (int | None) – Index of current branch (0-based).
source_index (int | None) – Index of current source (for multi-source).
source_name (str | None) – Name of current source.
duration_ms (float | None) – Duration in milliseconds (for completion events).