Skip to main content

initialize_logger

Function initialize_logger 

Source
pub fn initialize_logger(log_file: PathBuf)
Expand description

Initialize the logger from a file path — called by the activate_log proc-macro.

§Description

Sets up a file-backed tracing_appender subscriber that writes structured events to the given path. If a subscriber is already registered, the error is silently ignored (subsequent log events will route to whichever subscriber was installed first).

§Arguments

  • log_file (PathBuf): path to the log file. Parent directories will be created.

§Returns

Nothing. Infallible.

§Concurrency

Same as init_log.

§Examples

crypt_guard_core::log::initialize_logger(std::path::PathBuf::from("./crypt.log"));