From 024e306f73ca3e8dba1592673a4191e563f5b6da Mon Sep 17 00:00:00 2001 From: Felix Prasanna <91577249+fprasx@users.noreply.github.com> Date: Fri, 25 Aug 2023 10:09:53 -0400 Subject: [PATCH] monitor: improve logging (#5099) --- libs/vm_monitor/src/lib.rs | 2 +- libs/vm_monitor/src/runner.rs | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libs/vm_monitor/src/lib.rs b/libs/vm_monitor/src/lib.rs index da5b450b66..82d5d4b4d0 100644 --- a/libs/vm_monitor/src/lib.rs +++ b/libs/vm_monitor/src/lib.rs @@ -200,6 +200,6 @@ async fn start_monitor( match monitor.run().await { Ok(()) => info!("monitor was killed due to new connection"), - Err(e) => error!(error = ?e, "monitor terminated by itself"), + Err(e) => error!(error = ?e, "monitor terminated unexpectedly"), } } diff --git a/libs/vm_monitor/src/runner.rs b/libs/vm_monitor/src/runner.rs index 7f247386e9..cf871707f0 100644 --- a/libs/vm_monitor/src/runner.rs +++ b/libs/vm_monitor/src/runner.rs @@ -408,7 +408,9 @@ impl Runner { // there is a message from the informant msg = self.dispatcher.source.next() => { if let Some(msg) = msg { - info!(message = ?msg, "received message"); + // Don't use 'message' as a key as the string also uses + // that for its key + info!(?msg, "received message"); match msg { Ok(msg) => { let message: InboundMsg = match msg { @@ -417,7 +419,9 @@ impl Runner { } other => { warn!( - message = ?other, + // Don't use 'message' as a key as the + // string also uses that for its key + msg = ?other, "informant should only send text messages but received different type" ); continue @@ -429,7 +433,7 @@ impl Runner { Ok(None) => continue, Err(e) => { let error = e.to_string(); - warn!(%error, "error handling message"); + warn!(?error, "error handling message"); OutboundMsg::new( OutboundMsgKind::InternalError { error