working
This commit is contained in:
parent
133a1d2e8f
commit
e75ac7b3c0
6 changed files with 84 additions and 12 deletions
20
src-tauri/src/loggerbridge.rs
Normal file
20
src-tauri/src/loggerbridge.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
use std::sync::Arc;
|
||||
use tauri::Window;
|
||||
|
||||
#[derive(Clone, serde::Serialize)]
|
||||
pub struct LoggerPayload {
|
||||
pub message: String,
|
||||
pub message_type: String,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Logger {
|
||||
pub window: Arc<Window>,
|
||||
}
|
||||
|
||||
impl Logger {
|
||||
pub fn log(&self, message: String, message_type: String) {
|
||||
println!("{}", message);
|
||||
let _ = self.window.emit("log-event", LoggerPayload { message, message_type });
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue