From 1dab7b0efb2d859ea9887e55338bed9979be7e1a Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Sun, 7 Apr 2024 17:52:59 +0200 Subject: [PATCH] fixup! plugin: allow to exectute in an async way --- plugin/src/plugin.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/plugin/src/plugin.rs b/plugin/src/plugin.rs index 739d3d9..b715c58 100644 --- a/plugin/src/plugin.rs +++ b/plugin/src/plugin.rs @@ -70,7 +70,7 @@ impl log::Log for Log { let level: LogLevel = record.level().into(); let msg = record.args(); - let mut writer = io::stdout(); + let mut writer = std::io::stdout(); let mut payload = init_payload(); add_str(&mut payload, "level", &level.to_string()); add_str(&mut payload, "message", &format!("{msg}")); @@ -81,13 +81,10 @@ impl log::Log for Log { params: payload, }; - let _ = tokio::task::spawn(async move { - writer - .write_all(serde_json::to_string(&request).unwrap().as_bytes()) - .await - .unwrap(); - writer.flush().await.unwrap(); - }); + writer + .write_all(serde_json::to_string(&request).unwrap().as_bytes()) + .unwrap(); + writer.flush().unwrap(); } }