Skip to content

Commit

Permalink
fix: file logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ltitanb committed Sep 3, 2024
1 parent 77960c6 commit f52c624
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions crates/common/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,6 @@ pub fn initialize_tracing_log(module_id: &str) -> WorkerGuard {
.unwrap_or(false);

if use_file_logs {
let (writer, guard) = tracing_appender::non_blocking(std::io::stdout());
let stdout_layer = tracing_subscriber::fmt::layer()
.with_target(false)
.with_writer(writer)
.with_filter(stdout_filter);
tracing_subscriber::registry().with(stdout_layer).init();
guard
} else {
// Log all events to a rolling log file.
let mut builder =
tracing_appender::rolling::Builder::new().filename_prefix(module_id.to_lowercase());
Expand Down Expand Up @@ -178,6 +170,14 @@ pub fn initialize_tracing_log(module_id: &str) -> WorkerGuard {

tracing_subscriber::registry().with(stdout_layer.and_then(file_layer)).init();
guard
} else {
let (writer, guard) = tracing_appender::non_blocking(std::io::stdout());
let stdout_layer = tracing_subscriber::fmt::layer()
.with_target(false)
.with_writer(writer)
.with_filter(stdout_filter);
tracing_subscriber::registry().with(stdout_layer).init();
guard
}
}

Expand Down

0 comments on commit f52c624

Please sign in to comment.