From 694135a10b7262a3ad999443d91d42856b32d91f Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 5 Jul 2024 07:23:40 +0100 Subject: [PATCH] fix: default log level is info When RUST_LOG isn't set, the default log level is INFO rather than ERROR. Closes kemitix/git-next#104 --- crates/server/src/lib.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/server/src/lib.rs b/crates/server/src/lib.rs index 6d0efa6e..8a4003c7 100644 --- a/crates/server/src/lib.rs +++ b/crates/server/src/lib.rs @@ -4,8 +4,7 @@ use git_next_file_watcher_actor::{FileUpdated, FileWatcher}; use git_next_server_actor::Server; use kxio::{fs::FileSystem, network::Network}; use std::path::PathBuf; -use tracing::{error, info}; -use tracing_subscriber::EnvFilter; +use tracing::{error, info, level_filters::LevelFilter}; pub use git_next_server_actor::{repository_factory, RepositoryFactory}; @@ -69,13 +68,17 @@ pub fn start( pub fn init_logging() { use tracing_subscriber::prelude::*; + use tracing_subscriber::EnvFilter; let subscriber = tracing_subscriber::fmt::layer() - // NOTE: set RUSTLOG in ${root}/.cargo/config .with_target(false) .with_file(true) .with_line_number(true) - .with_filter(EnvFilter::from_default_env()); + .with_filter( + EnvFilter::builder() + .with_default_directive(LevelFilter::INFO.into()) + .from_env_lossy(), + ); tracing_subscriber::registry() .with(console_subscriber::ConsoleLayer::builder().spawn()) .with(subscriber)