Skip to main content

init_common_logging

Function init_common_logging 

Source
pub fn init_common_logging(
    app_name: &str,
    opts: CommonLoggingOptions,
) -> Result<ObservabilityGuards>
Expand description

Shared logging entry point for the satellite binaries (overlayd, web, manager, desktop).

Installs a structured tracing subscriber with an EnvFilter (honoring RUST_LOG), a console layer, and — by default — a daily-rotated file sink at ~/.zlayer/logs/<app_name>.log (reusing the same rolling-file + cleanup machinery as the daemon). OTLP forwarding is wired automatically from the OTEL_* environment, so satellites join the constellation’s ZLogging hook the moment an endpoint is configured (off by default).

Hold the returned guards for the lifetime of the process; dropping them flushes the async file writer and shuts the tracer provider down.

§Errors

Returns an error if a file sink is requested but the log directory cannot be created, or if OTLP forwarding is configured with a broken endpoint.