Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default log level to info #14

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/cmd/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use helix_api::service::ApiService;
use helix_common::{LoggingConfig, RelayConfig};
use tokio::runtime::Builder;
use tracing::level_filters::LevelFilter;

async fn run() {
let config = match RelayConfig::load() {
Expand All @@ -13,17 +14,16 @@ async fn run() {

let _guard;

let filter_layer = tracing_subscriber::EnvFilter::from_default_env().add_directive(LevelFilter::INFO.into());

match &config.logging {
LoggingConfig::Console => {
let filter_layer = tracing_subscriber::EnvFilter::from_default_env();
tracing_subscriber::fmt().with_env_filter(filter_layer).init();
}
LoggingConfig::File { dir_path, file_name } => {
let file_appender = tracing_appender::rolling::daily(dir_path, file_name);
let (non_blocking, guard) = tracing_appender::non_blocking(file_appender);

let filter_layer = tracing_subscriber::EnvFilter::from_default_env();

tracing_subscriber::fmt().with_env_filter(filter_layer).with_writer(non_blocking).init();
_guard = Some(guard);
}
Expand Down