From 5027ca2d634d3354085f90c54d4dc1e87d062ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Thu, 1 Feb 2024 13:54:57 +0100 Subject: [PATCH] feat: `activity:started` event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miroslav Bajtoš --- daemon/main.rs | 4 ++-- daemon/station_reporter.rs | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/daemon/main.rs b/daemon/main.rs index 7212fb92..99c1d169 100644 --- a/daemon/main.rs +++ b/daemon/main.rs @@ -16,7 +16,7 @@ use zinnia_runtime::{ get_module_root, lassie, lassie_config, resolve_path, run_js_module, BootstrapOptions, }; -use crate::station_reporter::{log_info_activity, StationReporter}; +use crate::station_reporter::{log_started_activity, StationReporter}; #[tokio::main(flavor = "current_thread")] async fn main() { @@ -56,7 +56,7 @@ async fn run(config: CliArgs) -> Result { .context("cannot initialize the IPFS retrieval client Lassie")?, ); - log_info_activity("Zinnia started"); + log_started_activity(); let file = &config.files[0]; diff --git a/daemon/station_reporter.rs b/daemon/station_reporter.rs index 47ddf72b..17d25d50 100644 --- a/daemon/station_reporter.rs +++ b/daemon/station_reporter.rs @@ -71,6 +71,15 @@ fn print_event(data: &serde_json::Value) { }); } +pub fn log_started_activity() { + let event = json!({ + "type": "activity:started", + "module": serde_json::Value::Null, + }); + print_event(&event); +} + +#[allow(unused)] pub fn log_info_activity(msg: &str) { let event = json!({ "type": "activity:info",