Added a custom log level filter impl

This commit is contained in:
Franklin 2022-08-29 11:31:46 -04:00
parent 98987bda30
commit a8395da5c9
3 changed files with 4 additions and 4 deletions

2
Cargo.lock generated
View File

@ -183,7 +183,7 @@ dependencies = [
[[package]] [[package]]
name = "actix-web-utils" name = "actix-web-utils"
version = "0.1.3" version = "0.1.4"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"log", "log",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "actix-web-utils" name = "actix-web-utils"
version = "0.1.3" version = "0.1.4"
edition = "2021" edition = "2021"
authors = ["Franklin E. Blanco"] authors = ["Franklin E. Blanco"]
description = "Just some useful addons for actix web." description = "Just some useful addons for actix web."

View File

@ -4,7 +4,7 @@ use crate::extensions::logger::SimpleLogger;
static LOGGER: SimpleLogger = SimpleLogger; static LOGGER: SimpleLogger = SimpleLogger;
pub fn init() -> Result<(), SetLoggerError> { pub fn init(max_log_level_filter: LevelFilter) -> Result<(), SetLoggerError> {
log::set_logger(&LOGGER) log::set_logger(&LOGGER)
.map(|()| log::set_max_level(LevelFilter::Info)) .map(|()| log::set_max_level(max_log_level_filter))
} }