Skip to content

Commit f66dc7e

Browse files
fix: change logging format to json (#469)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 95bb6fe commit f66dc7e

File tree

1 file changed

+4
-7
lines changed
  • crates/forge_tracker/src

1 file changed

+4
-7
lines changed

crates/forge_tracker/src/log.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,29 @@ use std::path::PathBuf;
22

33
use tracing::debug;
44
use tracing_appender::non_blocking::WorkerGuard;
5-
use tracing_subscriber::fmt::format::FmtSpan;
65
use tracing_subscriber::{self};
76

87
pub fn init_tracing(log_path: PathBuf) -> anyhow::Result<Guard> {
9-
debug!(path = %log_path.display(), "Initializing logging system");
8+
debug!(path = %log_path.display(), "Initializing logging system in JSON format");
109

1110
let append = tracing_appender::rolling::daily(log_path, "forge.log");
1211
let (non_blocking, guard) = tracing_appender::non_blocking(append);
1312

1413
tracing_subscriber::fmt()
15-
.pretty()
14+
.json()
1615
.with_env_filter(
1716
tracing_subscriber::EnvFilter::try_from_env("FORGE_LOG")
1817
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("forge=debug")),
1918
)
2019
.with_timer(tracing_subscriber::fmt::time::uptime())
2120
.with_thread_ids(false)
22-
.with_target(true)
21+
.with_target(false)
2322
.with_file(true)
2423
.with_line_number(true)
25-
.with_ansi(true)
26-
.with_span_events(FmtSpan::ACTIVE)
2724
.with_writer(non_blocking)
2825
.init();
2926

30-
debug!("Logging system initialized successfully");
27+
debug!("JSON logging system initialized successfully");
3128
Ok(Guard(guard))
3229
}
3330

0 commit comments

Comments
 (0)