From 1f0fc9a26da76dd685bf83eefc6c4c856c94a4c2 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 11 Mar 2026 06:30:02 +0000 Subject: [PATCH] log hooks: add more error context We may log things like this during shutdown: ``` logging-3 kumod::logging::hooks: Error while calling should_enqueue_log_record: shutting down ``` but it isn't clear which part of the operation is sensitive to the shutdown situation, so adding some context may help focus attention. --- crates/kumod/src/logging/hooks.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/kumod/src/logging/hooks.rs b/crates/kumod/src/logging/hooks.rs index 24d51d40..711039d0 100644 --- a/crates/kumod/src/logging/hooks.rs +++ b/crates/kumod/src/logging/hooks.rs @@ -175,11 +175,12 @@ impl LogHookState { LOGGING_RUNTIME.spawn("log-hook".to_string(), async move { let result: anyhow::Result<()> = async move { - let mut lua_config = load_config().await?; + let mut lua_config = load_config().await.context("load_config")?; let enqueue: bool = lua_config .async_call_callback(&SHOULD_ENQ_LOG_RECORD_SIG, (msg.clone(), name)) - .await?; + .await + .context("async_call_callback")?; lua_config.put(); // Release permit before we insert, as insertion itself can generate @@ -188,11 +189,13 @@ impl LogHookState { drop(permit); if enqueue { - let queue_name = msg.get_queue_name().await?; + let queue_name = msg.get_queue_name().await.context("get_queue_name")?; if !deferred_spool { - msg.save(None).await?; + msg.save(None).await.context("save")?; } - QueueManager::insert(&queue_name, msg, InsertReason::Received.into()).await?; + QueueManager::insert(&queue_name, msg, InsertReason::Received.into()) + .await + .context("insert")?; } Ok(()) }