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.
This commit is contained in:
Wez Furlong
2026-03-11 15:19:22 +00:00
parent 72e3c03af2
commit 1f0fc9a26d
+8 -5
View File
@@ -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(())
}