pub fn init_tracing(log_registry: Arc<ComponentLogRegistry>)Expand description
Tracing initialization function - call to set up component log routing Initialize the tracing subscriber with component log routing.
This sets up:
ComponentLogLayerfor routing logs to component-specific streamsfmt::layer()for console outputEnvFilterfor level control viaRUST_LOGenvironment variabletracing-logbridge forlogcrate compatibility
§Arguments
log_registry- The registry to route component logs to
§Example
ⓘ
use drasi_lib::managers::ComponentLogRegistry;
use std::sync::Arc;
let log_registry = Arc::new(ComponentLogRegistry::new());
drasi_lib::init_tracing(log_registry.clone());
// Now both tracing::info!() and log::info!() work
tracing::info!("Hello from tracing");
log::info!("Hello from log crate");§Note
If another log crate logger was initialized before calling this function,
log::info!() calls will go to that logger instead. However, tracing::info!()
calls will still be captured correctly.
§Deprecated
Prefer using get_or_init_global_registry() which handles initialization automatically.
This function is kept for backward compatibility.