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]]
name = "actix-web-utils"
version = "0.1.3"
version = "0.1.4"
dependencies = [
"actix-web",
"log",

View File

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

View File

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