Expand description
§Structured Logging for Thread Flow
Production-ready logging infrastructure with multiple output formats and log levels.
§Features
- Multiple Formats: JSON (production) and human-readable (development)
- Contextual Logging: Automatic span tracking with tracing
- Performance Tracking: Built-in duration tracking for operations
- Error Context: Rich error context with backtraces
§Usage
ⓘ
use thread_flow::monitoring::logging::{init_logging, LogConfig, LogLevel, LogFormat};
// Initialize logging (call once at startup)
init_logging(LogConfig {
level: LogLevel::Info,
format: LogFormat::Json,
..Default::default()
})?;
// Use macros for logging
info!("Processing file", file = "src/main.rs");
warn!("Cache miss", hash = "abc123...");
error!("Database connection failed", error = %err);
// Structured logging with spans
let span = info_span!("analyze_file", file = "src/main.rs");
let _guard = span.enter();
// All logs within this scope will include file contextModules§
- structured
- Structured logging helpers
Structs§
- LogConfig
- Logging configuration
Enums§
- LogFormat
- Log output format
- LogLevel
- Log level configuration
- Logging
Error - Logging errors
Functions§
- init_
cli_ logging - Initialize logging for CLI applications
- init_
logging - Initialize logging infrastructure
- init_
production_ logging - Initialize logging for production/edge deployments