pub fn init_logger<P: AsRef<Path>>(file_path: Option<P>) -> Result<(), LogError>Expand description
Initialize a logger with default configuration.
This uses LoggerConfig::default() which sets:
Infoas the minimum log level- File information shown in logs
- No date in stdout output (only time)
- Colors enabled for terminal output
§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 default settings");