Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 93 additions & 20 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ tokio-util = { workspace = true }
postcard = { workspace = true }
dirs = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }

[dev-dependencies]
tauri = { version = "2", features = ["test"] }
Expand Down Expand Up @@ -66,5 +67,6 @@ postcard = "1.1"
bech32 = "0.11"
dirs = "5"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
sha2 = "0.10"
base64 = "0.22"
14 changes: 14 additions & 0 deletions src-tauri/src/commands/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,20 @@ pub async fn tunnel_status(state: State<'_, AppState>) -> AppResult<TunnelStatus
Ok(tunnel::status(&state).await)
}

/// The in-memory application log (oldest line first), for display + copy in the
/// app. Captured from `tracing` since app start; bounded and not persisted.
#[tauri::command]
pub async fn get_logs() -> AppResult<Vec<String>> {
Ok(crate::logbuf::global().snapshot())
}

/// Discard the buffered log lines.
#[tauri::command]
pub async fn clear_logs() -> AppResult<()> {
crate::logbuf::global().clear();
Ok(())
}

#[tauri::command]
pub async fn sidecar_status(state: State<'_, AppState>) -> AppResult<SidecarStatus> {
sidecar::status(&state).await
Expand Down
7 changes: 7 additions & 0 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub mod commands;
pub mod error;
pub mod logbuf;
pub mod sidecar;
pub mod state;
pub mod tunnel;
Expand Down Expand Up @@ -44,6 +45,10 @@ async fn run_auto_lock_monitor<R: tauri::Runtime>(app: tauri::AppHandle<R>) {
}

pub fn run() {
// Start capturing `tracing` output (to stdout + the in-app log buffer) before
// anything else runs, so early diagnostics are recorded too.
logbuf::init_logging();

tauri::Builder::default()
.plugin(tauri_plugin_shell::init())
.manage(AppState::new())
Expand Down Expand Up @@ -106,6 +111,8 @@ pub fn run() {
commands::server::start_tunnel,
commands::server::stop_tunnel,
commands::server::tunnel_status,
commands::server::get_logs,
commands::server::clear_logs,
commands::dkg::start_dkg,
commands::dkg::cancel_ceremony,
commands::signing::create_signing_session,
Expand Down
Loading
Loading