From 3a86e8e51083021fd593b0d28ba34dd5d819fed7 Mon Sep 17 00:00:00 2001 From: Thomas Avery Date: Thu, 15 Aug 2024 10:34:33 -0500 Subject: [PATCH] set level --- crates/bitwarden-wasm/src/client.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/bitwarden-wasm/src/client.rs b/crates/bitwarden-wasm/src/client.rs index 2e07a81dc..e130705c1 100644 --- a/crates/bitwarden-wasm/src/client.rs +++ b/crates/bitwarden-wasm/src/client.rs @@ -4,7 +4,7 @@ use std::rc::Rc; use argon2::{Algorithm, Argon2, Params, Version}; use bitwarden_json::client::Client as JsonClient; use js_sys::Promise; -use log::{warn, Level}; +use log::{set_max_level, Level}; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::future_to_promise; @@ -37,10 +37,9 @@ impl BitwardenClient { #[wasm_bindgen(constructor)] pub fn new(settings_input: Option, log_level: Option) -> Self { console_error_panic_hook::set_once(); - if let Err(_e) = - console_log::init_with_level(convert_level(log_level.unwrap_or(LogLevel::Info))) - { - warn!("Logger already initialized, log level will not be changed."); + let log_level = convert_level(log_level.unwrap_or(LogLevel::Info)); + if let Err(_e) = console_log::init_with_level(log_level) { + set_max_level(log_level.to_level_filter()) } Self(Rc::new(bitwarden_json::client::Client::new(settings_input)))