Skip to main content

init_logger

Function init_logger 

Source
pub fn init_logger(level: LogLevel, file_name: &str) -> Option<WorkerGuard>
Expand description

Initializes the global logger. Writing a Lib? Only use the tracing crate and its macros (info!, span!). Do not initialize anything. Writing a Binary? Use tracing-subscriber to build the registry and handlers. Missing dependency logs? Check your EnvFilter string rules and ensure the “log” feature is enabled on tracing-subscriber to catch legacy logs Returns a WorkerGuard that must be kept alive to ensure logs are flushed to the file. If later wanna do rsyslog (libc): https://docs.rs/syslog-tracing/0.3.1/syslog_tracing/struct.Syslog.html Or the newcomer full rust: https://crates.io/crates/tracing-rfc-5424