Skip to main content

init_from_env

Function init_from_env 

Source
pub fn init_from_env()
Expand description

Initializes prologger using the RUST_LOG environment variable.

This reads the RUST_LOG env var for level configuration:

  • RUST_LOG=debug — sets global level to debug
  • RUST_LOG=warn,my_app=debug — warn globally, debug for my_app

If RUST_LOG is not set, defaults to Info level.

§Panics

Panics if RUST_LOG contains invalid syntax or if a logger is already set.

§Example

// Set RUST_LOG=debug before running
prologger::init_from_env();
log::debug!("This shows when RUST_LOG=debug");