diff --git a/src/append/fastrace.rs b/src/append/fastrace.rs index e069739..f252464 100644 --- a/src/append/fastrace.rs +++ b/src/append/fastrace.rs @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::borrow::Cow; + use jiff::Zoned; use log::Record; use crate::append::Append; use crate::layout::collect_kvs; -use crate::layout::KvDisplay; /// An appender that adds log records to fastrace as an event associated to the current span. #[derive(Default, Debug, Clone)] @@ -27,8 +28,16 @@ impl Append for FastraceEvent { fn append(&self, record: &Record) -> anyhow::Result<()> { let message = format!("{}", record.args()); fastrace::Event::add_to_local_parent(message, || { - [("level", record.level()), ("timestamp", Zoned::now())] - .chain(collect_kvs(record.key_values())) + [ + (Cow::from("level"), Cow::from(record.level().as_str())), + (Cow::from("timestamp"), Cow::from(Zoned::now().to_string())), + ] + .into_iter() + .chain( + collect_kvs(record.key_values()) + .into_iter() + .map(|(k, v)| (Cow::from(k), Cow::from(v))), + ) }); Ok(()) }