pub fn init_observability(
logging_config: &StructuredLoggingConfig,
otel_config: Option<&ObservabilityConfig>,
service_name: &str,
environment: &str,
log_level: &str,
) -> Result<(LogBuffer, OtelShutdownGuard), Error>Expand description
Unified observability initialization.
Combines structured logging (fmt layer) and optional OpenTelemetry tracing
into a single global subscriber. This replaces the old pattern of calling
init_structured_logging() + init_tracing_with_otel() separately, which
caused a double-subscriber bug where the second set_global_default call
silently failed and the OTel layer was never active.
§Arguments
logging_config— Structured logging settings (JSON/pretty, fields, buffer)otel_config— Optional OTel configuration. WhenSomeandtracing_enabled, an OTel layer is added (with optional OTLP exporter).service_name— Identifies the service in logs and traces.environment— e.g. “development”, “production”.log_level— Filter directive such as “info” or “backbone=debug”.