Skip to main content

install_for_daemon

Function install_for_daemon 

Source
pub fn install_for_daemon(state: Arc<IdentityConflict>)
Expand description

Install IdentityConflictLayer as the process-global subscriber. Standalone daemon only.

A tracing subscriber is process-global and can be set once. serve_forever owns its process and installs none of its own, so taking it there is safe. It must NOT be called from any path an embedded node shares: seizing the global would panic a host that calls fmt::init() afterwards, and silently swallow its logs for the process lifetime if it uses try_init().

The layer is filtered to WARN, which matters for more than tidiness: tracing’s max-level hint is derived from the installed subscriber, and a bare registry sets it to TRACE — turning every trace! and trace_span! in iroh, quinn and tokio from a compiled-out no-op into an allocation on the datagram hot path, for a daemon that prints nothing anyway.

Best effort: if a subscriber already exists we leave it alone and say so at debug!.