Skip to main content

Mountain/Vine/Server/Notification/Support/
RelayToSky.rs

1
2//! Shared helper for notification atoms that are pure sky-event relays.
3//!
4//! Many Cocoon → Mountain notification atoms do exactly two things:
5//! 1. `ApplicationHandle.emit(sky_event, Parameter)`
6//! 2. `dev_log!(tag, "...")`
7//!
8//! This function collapses that pair so each such atom is a one-liner.
9//!
10//! - `SkyEvent` - the `sky://…` Tauri event name.
11//! - `LogTag`   - the dev-log tag (`"grpc"`, `"output-verbose"`, …).
12//! - `LogLine`  - pre-formatted message; skipped when empty.
13
14use serde_json::Value;
15use tauri::Emitter;
16
17use crate::{Vine::Server::MountainVinegRPCService::MountainVinegRPCService, dev_log};
18
19pub fn RelayToSky(Service:&MountainVinegRPCService, SkyEvent:&str, Parameter:&Value, LogTag:&str, LogLine:&str) {
20	let _ = Service.ApplicationHandle().emit(SkyEvent, Parameter);
21
22	if !LogLine.is_empty() {
23		dev_log!(LogTag, "{}", LogLine);
24	}
25}