Skip to main content

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

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