pub fn init_logger_with_level<P: AsRef<Path>>(
file_path: Option<P>,
level: LevelFilter,
) -> Result<(), LogError>Expand description
Initialize a logger with a specific log level.
This uses the default configuration but overrides the log level.
§Arguments
file_path- Optional path to a log file. IfNone, logs will only go to stdout.level- The minimum log level to display.
§Returns
Ok(()) if initialization succeeded, or an error if it failed.
§Example
use fstdout_logger::init_logger_with_level;
use log::LevelFilter;
init_logger_with_level(Some("debug.log"), LevelFilter::Debug)
.expect("Failed to initialize logger");