Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Commit

Permalink
add loc to term output
Browse files Browse the repository at this point in the history
  • Loading branch information
KodrAus committed Jan 17, 2024
1 parent ef257bf commit cedf7fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion targets/term/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use core::{fmt, str, time::Duration};
use std::{cell::RefCell, cmp, io::Write, sync::Mutex};

use emit::{
well_known::{METRIC_KIND_SUM, METRIC_VALUE_KEY, TRACE_ID_KEY},
well_known::{METRIC_KIND_SUM, METRIC_VALUE_KEY, TRACE_ID_KEY, LOCATION_KEY},
Event,
};
use emit_metrics::{Bucketing, MetricsCollector};
Expand Down Expand Up @@ -293,6 +293,10 @@ fn print_event(
}
}

if let Some(loc) = evt.props().get(LOCATION_KEY) {
write_fg(buf, format_args!("{} ", loc), LOCATION);
}

let _ = evt.msg().write(Writer { buf });
write_plain(buf, "\n");

Expand Down Expand Up @@ -397,6 +401,8 @@ impl<'a> emit::template::Write for Writer<'a> {
}
}

const LOCATION: Color = Color::Ansi256(244);

const TEXT: Color = Color::Ansi256(69);
const NUMBER: Color = Color::Ansi256(135);
const ATOM: Color = Color::Ansi256(168);
Expand Down
2 changes: 1 addition & 1 deletion tests/smoke-test/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async fn main() {
.scope("some-scope", "0.1", emit::props! {})
.spawn()
.unwrap())
//.and_to(emit_term::stdout().plot_metrics_by_count(30))
.and_to(emit_term::stdout().plot_metrics_by_count(30))
.init();

emit::setup()
Expand Down

0 comments on commit cedf7fe

Please sign in to comment.