diff --git a/targets/term/src/lib.rs b/targets/term/src/lib.rs index 1415701..79eb968 100644 --- a/targets/term/src/lib.rs +++ b/targets/term/src/lib.rs @@ -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}; @@ -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"); @@ -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); diff --git a/tests/smoke-test/main.rs b/tests/smoke-test/main.rs index e9d1d59..55d723e 100644 --- a/tests/smoke-test/main.rs +++ b/tests/smoke-test/main.rs @@ -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()