pub fn init_logger<P: AsRef<Path>>(file_path: Option<P>) -> Result<(), LogError>Expand description
Initialize a logger with default configuration.
This automatically reads from environment variables:
RUST_LOGfor module-level filteringLOG_LEVELfor numeric log level (0-5)
If neither is set, defaults to Info level with standard settings.
§Arguments
file_path- Optional path to a log file. IfNone, logs will only go to stdout.
§Returns
Ok(()) if initialization succeeded, or an error if it failed.
§Example
use fstdout_logger::init_logger;
use log::info;
init_logger(Some("app.log")).expect("Failed to initialize logger");
info!("Logger initialized with environment variable support");