Expand description
Unified logging and observability for the rust-ai ecosystem.
§Why This Module Exists
ML training and inference generate massive amounts of diagnostic data:
- Training progress (loss, learning rate, throughput)
- Memory usage and allocation patterns
- Device information and kernel timings
- Errors and warnings
Without consistent logging configuration, each crate would implement its own approach, leading to inconsistent output formats and configuration mechanisms.
This module provides:
- Unified log initialization: Single function to configure logging for all crates
- Structured logging helpers: Consistent field names for metrics and events
- Progress tracking: Training loop progress bars and ETA estimation
§Design Decisions
- tracing-based: Uses the
tracingecosystem for structured logging with spans - Environment-driven: Log levels configured via
RUST_LOGenvironment variable - Zero-cost when disabled: All logging compiles to no-ops when level is filtered
Macros§
- debug
- Constructs an event at the debug level.
- error
- Constructs an event at the error level.
- info
- Constructs an event at the info level.
- trace
- Constructs an event at the trace level.
- warn
- Constructs an event at the warn level.
Structs§
- LogConfig
- Configuration for logging initialization.
Enums§
- LogLevel
- Log level enumeration.
Functions§
- init_
logging - Initialize logging for the rust-ai ecosystem.
- log_
memory_ usage - Log memory usage.
- log_
training_ step - Log a training step with standard fields.