tracing: Log to stderr, and drop timestamps#98
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the tracing setup to prevent log messages from interfering with JSON output on standard output. The changes correctly configure logging to use standard error, remove timestamps, and apply a compact format. The implementation in crates/kit/src/main.rs is sound and effectively uses the tracing-subscriber API. I have one suggestion to improve code conciseness.
| let format = fmt::format().without_time().with_target(false).compact(); | ||
|
|
||
| let fmt_layer = fmt::layer() | ||
| .event_format(format) | ||
| .with_writer(std::io::stderr); |
There was a problem hiding this comment.
Since the format variable is only used once, you could consider inlining its definition directly into the .event_format() call. This would make the fmt_layer configuration more concise and express it as a single fluent chain of calls, which is a common pattern when using builders in Rust.
| let format = fmt::format().without_time().with_target(false).compact(); | |
| let fmt_layer = fmt::layer() | |
| .event_format(format) | |
| .with_writer(std::io::stderr); | |
| let fmt_layer = fmt::layer() | |
| .event_format(fmt::format().without_time().with_target(false).compact()) | |
| .with_writer(std::io::stderr); |
This matches bootc's setup (without the journal integration for now as we don't strictly need it). But specifically this fixes setting `RUST_LOG` and having that break the monitor-status JSON stream: bootc-dev#86 (comment) Signed-off-by: Colin Walters <walters@verbum.org>
For reasons I haven't debugged yet this breaks our systemd/vsock integration. Signed-off-by: Colin Walters <walters@verbum.org>
c421f3f to
9cfc18e
Compare
This matches bootc's setup (without the journal integration for now as we don't strictly need it).
But specifically this fixes setting
RUST_LOGand having that break the monitor-status JSON stream:#86 (comment)