From e1fc88ff700aeae3123e6bbc9d8152562788f86e Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 27 Jul 2022 15:31:46 +0200 Subject: [PATCH] cln-plugin: Prep the logging payload in a let I wanted to debug why we weren't getting some log messages, and this makes that a bit easier in future. --- plugins/src/logging.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/src/logging.rs b/plugins/src/logging.rs index 365648463..b752c4291 100644 --- a/plugins/src/logging.rs +++ b/plugins/src/logging.rs @@ -63,15 +63,13 @@ where // errors when forwarding. Forwarding could break due to // an interrupted connection or stdout being closed, but // keeping the messages in the queue is a memory leak. - let _ = out - .lock() - .await - .send(json!({ - "jsonrpc": "2.0", - "method": "log", - "params": i - })) - .await; + let payload = json!({ + "jsonrpc": "2.0", + "method": "log", + "params": i + }); + + let _ = out.lock().await.send(payload).await; } }); log::set_boxed_logger(Box::new(PluginLogger { sender, filter }))