about summary refs log tree commit diff
path: root/src/bin
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2024-12-30 22:57:57 +0300
committerVika <vika@fireburn.ru>2024-12-30 22:57:57 +0300
commit8a171364794df244acb335558a208a628de9f94d (patch)
tree465e5baff8f0c5cfe7c43d87d357211b3fe23f72 /src/bin
parentfad3c4d38e62165302053be27b45a027106d73d9 (diff)
downloadkittybox-8a171364794df244acb335558a208a628de9f94d.tar.zst
kittybox-mf2: add tracing
Change-Id: I9ed27cbf17ab65ec35ca45b36a4144296c7b6a6e
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/kittybox-mf2.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/bin/kittybox-mf2.rs b/src/bin/kittybox-mf2.rs
index 85ebc6f..0cd89b4 100644
--- a/src/bin/kittybox-mf2.rs
+++ b/src/bin/kittybox-mf2.rs
@@ -26,6 +26,22 @@ enum Error {
 
 #[tokio::main]
 async fn main() -> Result<(), Error> {
+    use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Registry};
+
+    let tracing_registry = Registry::default()
+        .with(EnvFilter::from_default_env())
+        .with(
+            #[cfg(debug_assertions)]
+            tracing_tree::HierarchicalLayer::new(2)
+                .with_bracketed_fields(true)
+                .with_indent_lines(true)
+                .with_verbose_exit(true),
+            #[cfg(not(debug_assertions))]
+            tracing_subscriber::fmt::layer().json()
+                .with_ansi(std::io::IsTerminal::is_terminal(&std::io::stdout().lock()))
+        );
+    tracing_registry.init();
+
     let args = Args::parse();
 
     let http: reqwest::Client = {