Function jacklog::init

source ·
pub fn init<T: AsRef<str>>(
    default_level: Option<&T>
) -> Result<(), SetGlobalDefaultError>
Expand description

Basic invocation. Simply call jacklog::init(Some("mybin=debug")) to automatically set a default log level, that can be overridden via the usual RUST_LOG env var.

All logs will go to STDERR. If jacklog detects that STDERR is NOT a TTY, then logs will be output as JSON, ready to be parsed by log aggregators. If STDERR IS a TTY, then logs will be output nicely formatted.

Errors

Will return an error if there’s an issue setting the global default subscriber.