Skip to content

Commit

Permalink
Move to logging with logfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
elkowar committed Oct 22, 2023
1 parent dcb7f4e commit 25a1fc6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
25 changes: 24 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/robbb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ libhoney-rust = { git = "https://github.com/nlopes/libhoney-rust", rev = "f64def
robbb_db = { path = "../robbb_db" }
robbb_util = { path = "../robbb_util" }
robbb_commands = { path = "../robbb_commands" }
tracing-logfmt = { version = "0.3.3", features = ["ansi_logs"] }

[target.'cfg(any(target_os = "windows", target_os = "linux"))'.dependencies]
cpu-monitor = "0.1.1"
9 changes: 8 additions & 1 deletion crates/robbb/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ pub fn init_tracing(honeycomb_api_key: Option<String>) {
let sub = tracing_subscriber::registry::Registry::default()
.with(log_filter)
.with(remove_presence_update_filter)
.with(tracing_subscriber::fmt::Layer::default());
.with(
tracing_logfmt::builder()
.with_level(true)
.with_target(true)
.with_span_name(true)
.with_span_path(true)
.layer(),
);

if let Some(api_key) = honeycomb_api_key {
tracing::info!("honeycomb api key is set, initializing honeycomb layer");
Expand Down

0 comments on commit 25a1fc6

Please sign in to comment.