Skip to content

Commit

Permalink
set level
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Avery committed Aug 15, 2024
1 parent 2da01df commit 3a86e8e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions crates/bitwarden-wasm/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -37,10 +37,9 @@ impl BitwardenClient {
#[wasm_bindgen(constructor)]
pub fn new(settings_input: Option<String>, log_level: Option<LogLevel>) -> 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())

Check warning on line 42 in crates/bitwarden-wasm/src/client.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden-wasm/src/client.rs#L40-L42

Added lines #L40 - L42 were not covered by tests
}

Self(Rc::new(bitwarden_json::client::Client::new(settings_input)))
Expand Down

0 comments on commit 3a86e8e

Please sign in to comment.