Skip to main content

init_tracing

Function init_tracing 

Source
pub fn init_tracing(settings: &LogSettings) -> Result<WorkerGuard>
Expand description

Initialize the process-global tracing subscriber: a non-blocking rolling file writer under settings.dir, plus a stderr writer when a console is actually attached (a scheduled/cron invocation typically has none). Never touches stdout – see the module doc comment.

Returns the WorkerGuard, which the caller must hold for the process lifetime – dropping it early silently truncates buffered log lines that haven’t yet been flushed to disk on exit. A logging setup failure (e.g. an unwritable log directory) is not fatal to the CLI’s command or the server’s primary service, so their startup paths treat the returned Err as best-effort rather than propagating it.