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. Best-effort: setup failing (e.g. an unwritable log directory) is intentionally not fatal to the CLI’s actual job (running a tune and printing its result), so callers other than this module’s own tests should ignore the returned Err rather than propagate it – see lib.rs::run.