diff options
author | Vika <vika@fireburn.ru> | 2023-07-09 01:32:31 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2023-07-09 01:32:31 +0300 |
commit | 7724c54b4bd8edc9c9cca3e0ae1b459b4550e0fb (patch) | |
tree | a88c406d39c36210844d48d2edb7b9c7bb5e83e8 /kittybox-rs/src/main.rs | |
parent | 46a37df2184851f6df35d85b479137caa7d6162b (diff) | |
download | kittybox-7724c54b4bd8edc9c9cca3e0ae1b459b4550e0fb.tar.zst |
main: use tracing_tree in debug builds
This gives me much more readable traces. JSON logging is still superior in production, where logs are stored in systemd-journald and preferably need to be self-contained lines.
Diffstat (limited to 'kittybox-rs/src/main.rs')
-rw-r--r-- | kittybox-rs/src/main.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/kittybox-rs/src/main.rs b/kittybox-rs/src/main.rs index 3136924..68d3b01 100644 --- a/kittybox-rs/src/main.rs +++ b/kittybox-rs/src/main.rs @@ -147,10 +147,18 @@ where #[tokio::main] async fn main() { use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Registry}; + Registry::default() .with(EnvFilter::from_default_env()) - .with(tracing_subscriber::fmt::layer().json()) + //.with(tracing_subscriber::fmt::layer().json()) + .with( + #[cfg(debug_assertions)] + tracing_tree::HierarchicalLayer::new(2), + #[cfg(not(debug_assertions))] + tracing_subscriber::fmt::layer().json() + ) .init(); + //let _ = tracing_log::LogTracer::init(); info!("Starting the kittybox server..."); |