Skip to content

Commit 7c7340a

Browse files
authored
fix: update tracing subscriber to write JSON output to stderr (#340)
What broke: The commit added performance tracing/logging code. The new code was using a library called tracing-subscriber which, by default, writes log messages to stdout. This corrupted the JSONRPC protocol, causing the "Connection Error" and endless loading. Fix: tracing library to write to stderr (standard error) instead of stdout.
1 parent d9fc8f7 commit 7c7340a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/pet/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,16 @@ pub fn initialize_tracing(verbose: bool) {
4747
if use_json {
4848
tracing_subscriber::registry()
4949
.with(filter)
50-
.with(fmt::layer().json())
50+
.with(fmt::layer().json().with_writer(std::io::stderr))
5151
.init();
5252
} else {
5353
tracing_subscriber::registry()
5454
.with(filter)
5555
.with(
5656
fmt::layer()
5757
.with_target(true)
58-
.with_timer(fmt::time::uptime()),
58+
.with_timer(fmt::time::uptime())
59+
.with_writer(std::io::stderr),
5960
)
6061
.init();
6162
}

0 commit comments

Comments
 (0)