pub struct LoggingEngine { /* private fields */ }Expand description
The non-blocking logging engine.
Internally holds a sender to a tokio mpsc channel. All heavy I/O happens in a background task on a dedicated tokio runtime thread.
Implementations§
Source§impl LoggingEngine
impl LoggingEngine
Sourcepub fn new(config: ExperimentConfig) -> Result<Self>
pub fn new(config: ExperimentConfig) -> Result<Self>
Create a new LoggingEngine for the given config.
This initializes the run directory, writes initial metadata, and spawns the background I/O task.
Sourcepub fn log_metrics(
&self,
values: HashMap<String, MetricValue>,
step: Option<u64>,
)
pub fn log_metrics( &self, values: HashMap<String, MetricValue>, step: Option<u64>, )
Log a row of metrics. Non-blocking — channel send only.
Sourcepub fn log_params(&self, params: HashMap<String, Value>)
pub fn log_params(&self, params: HashMap<String, Value>)
Log/update experiment parameters (config). Non-blocking.
Sourcepub fn save_artifact(&self, path: PathBuf)
pub fn save_artifact(&self, path: PathBuf)
Save an artifact file asynchronously. Non-blocking. The path is relative to the current working directory for the source, and will be preserved as a relative path within the run’s artifacts directory.
Sourcepub fn log_message(&self, level: LogLevel, message: String)
pub fn log_message(&self, level: LogLevel, message: String)
Log a message to the run log. Non-blocking.
Sourcepub async fn flush(&self) -> Result<()>
pub async fn flush(&self) -> Result<()>
Force flush the metric buffer to disk. Async — awaits completion.
Sourcepub fn close(&self, status: RunStatus)
pub fn close(&self, status: RunStatus)
Gracefully shut down: flush all pending metrics, write final metadata. Blocks until complete. Should be called at experiment end.