proxmox-perl-rs/common/src/logger.rs
Lukas Wagner c7c3940718 initialize logging when shared library is loaded
This commit sets up logging by hooking into module loading/bootstraping
process to call a new `init` function exported by the `Proxmox::Lib::{PVE,PMG}`
module, which initializes `env_logger` with its default settings.

This allows us to use `log::*` macros from Rust code.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-03-07 12:02:02 +01:00

7 lines
175 B
Rust

/// Initialize logging. Should only be called once
pub fn init() {
if let Err(e) = env_logger::try_init() {
eprintln!("could not set up env_logger: {e}");
}
}