Skip to content

Commit

Permalink
Force file to only log info, like the desktop app does
Browse files Browse the repository at this point in the history
  • Loading branch information
dani-garcia committed Nov 14, 2024
1 parent 96f6257 commit 6b95ac1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/desktop/desktop_native/proxy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ use tokio_util::codec::LengthDelimitedCodec;
#[cfg(target_os = "macos")]
embed_plist::embed_info_plist!("../../../resources/info.desktop_proxy.plist");

fn init_logging(log_path: &Path, level: log::LevelFilter) {
fn init_logging(log_path: &Path, console_level: LevelFilter, file_level: LevelFilter) {
use simplelog::{ColorChoice, CombinedLogger, Config, SharedLogger, TermLogger, TerminalMode};

let config = Config::default();

let mut loggers: Vec<Box<dyn SharedLogger>> = Vec::new();
loggers.push(TermLogger::new(
level,
console_level,
config.clone(),
TerminalMode::Stderr,
ColorChoice::Auto,
));

match std::fs::File::create(log_path) {
Ok(file) => {
loggers.push(simplelog::WriteLogger::new(level, config, file));
loggers.push(simplelog::WriteLogger::new(file_level, config, file));
}
Err(e) => {
eprintln!("Can't create file: {}", e);
Expand Down Expand Up @@ -62,7 +62,7 @@ async fn main() {
.and_then(|s| s.parse().ok())
.unwrap_or(LevelFilter::Info);

init_logging(&log_path, level);
init_logging(&log_path, level, LevelFilter::Info);

info!("Starting Bitwarden IPC Proxy.");

Expand Down

0 comments on commit 6b95ac1

Please sign in to comment.