Skip to content

Commit 14597dd

Browse files
committed
test
1 parent a9f0377 commit 14597dd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

ghostscope/src/logging.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ pub fn initialize_logging_with_config(
3636
// Initialize LogTracer but ignore 'already set' errors to avoid noisy output
3737
let _ = tracing_log::LogTracer::init();
3838

39-
// Build EnvFilter from RUST_LOG if present; otherwise fall back to configured log_level
40-
// This enables module-level filtering like: RUST_LOG="info,ghostscope_loader=debug,ghostscope_protocol=debug"
41-
let env_filter = build_env_filter(log_level);
42-
4339
let event_format = tracing_subscriber::fmt::format()
4440
.with_target(true)
4541
.with_level(true)
@@ -69,21 +65,23 @@ pub fn initialize_logging_with_config(
6965

7066
if enable_console_logging {
7167
// Console logging enabled: dual output to file and stdout with level filter
68+
let env_filter = build_env_filter(log_level);
7269
let stdout_layer = tracing_subscriber::fmt::layer()
7370
.event_format(event_format.clone())
7471
.with_writer(std::io::stdout)
7572
.with_ansi(true);
7673

7774
let init_res = tracing_subscriber::registry()
78-
.with(env_filter.clone())
75+
.with(env_filter)
7976
.with(file_layer)
8077
.with(stdout_layer)
8178
.try_init();
8279
let _ = init_res;
8380
} else {
8481
// Console logging disabled: only log to file
82+
let env_filter = build_env_filter(log_level);
8583
let init_res = tracing_subscriber::registry()
86-
.with(env_filter.clone())
84+
.with(env_filter)
8785
.with(file_layer)
8886
.try_init();
8987
let _ = init_res; // ignore AlreadyInit errors silently
@@ -92,6 +90,7 @@ pub fn initialize_logging_with_config(
9290
Err(_) => {
9391
// Fallback to stdout only if file creation fails and console logging is enabled
9492
if enable_console_logging {
93+
let env_filter = build_env_filter(log_level);
9594
let stdout_layer = tracing_subscriber::fmt::layer()
9695
.event_format(event_format)
9796
.with_writer(std::io::stdout);

0 commit comments

Comments
 (0)