Tauri Plugin Integration
Use this guide when integrating the Rust plugin crate tauri-plugin-tauri-watch.
Install
cd src-tauri
cargo add tauri-plugin-tauri-watchRegister
For a standard Tauri v2 app:
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_tauri_watch::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}If your app uses lib.rs:
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_tauri_watch::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}Configuration
The plugin reads plugins.tauri-watch from tauri.conf.json.
{
"plugins": {
"tauri-watch": {
"appId": "my-tauri-app",
"apiKey": "YOUR_TAURIWATCH_API_KEY",
"endpoint": "https://tauri-watch.cloud.alkkmia.com",
"environment": "production",
"releaseVersion": "1.0.0",
"appVersion": "1.0.0",
"tauriVersion": "2",
"enabled": true,
"batchSize": 20,
"flushIntervalMs": 3000,
"retryAttempts": 3,
"queueFilePath": null
}
}
}Required fields:
appIdapiKeyendpointenvironmentreleaseVersion
Optional fields:
appVersiontauriVersionenabledbatchSizeflushIntervalMsretryAttemptsqueueFilePath
Frontend Bindings
Install:
npm install @alkkmia/tauri-plugin-tauri-watch-apiUse:
import {
captureError,
flush,
installGlobalHandlers,
logError,
logInfo,
logWarn,
} from "@alkkmia/tauri-plugin-tauri-watch-api";
installGlobalHandlers();
await logInfo("App started");
await logWarn("Slow command", { command: "sync" });
await logError("Recoverable error", { module: "billing" });
try {
await riskyOperation();
} catch (error) {
await captureError(error, {
source: "frontend",
severity: "high",
handled: true,
});
}
await flush();What the Plugin Captures
- Manual frontend logs through the JS plugin bindings.
- Manual frontend errors through
captureError. - Global frontend errors when
installGlobalHandlers()is called. - Rust panics through the Rust SDK panic hook.
- Rust logs through the Rust SDK
logbridge initialized by the plugin.
When to Use the Standalone SDK
Use @alkkmia/tauri-watch-sdk directly when:
- You want session replay.
- You want direct webview ingestion without invoking Rust plugin commands.
- You are instrumenting a non-Tauri web surface that reports to the same TauriWatch backend.