Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(tauri): log js to term (#845)

Sean Ayed3b5107093a6
diff --git a/js/app/bun.lock b/js/app/bun.lock
index 5db36bf71a..ab6dcde857 100644
--- a/js/app/bun.lock
+++ b/js/app/bun.lock
@@ -1,5 +1,6 @@
{
"lockfileVersion": 1,
+ "configVersion": 0,
"workspaces": {
"": {
"name": "@coparse/monorepo",
@@ -155,6 +156,7 @@
"version": "2.5.0",
"dependencies": {
"@macro/tauri": "workspace:*",
+ "@tauri-apps/plugin-log": "^2.7.1",
"@types/three": "^0.178.0",
"core": "workspace:*",
"mermaid": "^11.6.0",
@@ -1147,6 +1149,8 @@
"@tauri-apps/plugin-http": ["@tauri-apps/[email protected]", "", { "dependencies": { "@tauri-apps/api": "^2.8.0" } }, "sha512-x1mQKHSLDk4mS2S938OTeyk8L7QyLpCrKZCZcjkljGsvTvRMojCvI9SeJ1kaxc7t8xSilkC7WdId8xER9TIGLg=="],
+ "@tauri-apps/plugin-log": ["@tauri-apps/[email protected]", "", { "dependencies": { "@tauri-apps/api": "^2.8.0" } }, "sha512-jdb+o0wxQc8PjnLktgGpOs9Dh1YupaOGDXzO+Y8peA1UZ1ep3eXv4E1oiJ7nIQVN0XUFDDhnn3aBszl8ijhR+A=="],
+
"@tauri-apps/plugin-notification": ["@tauri-apps/[email protected]", "", { "dependencies": { "@tauri-apps/api": "^2.8.0" } }, "sha512-7gqgfANSREKhh35fY1L4j3TUjUdePmU735FYDqRGeIf8nMXWpcx6j4FhN9/4nYz+m0mv79DCTPLqIPTySggGgg=="],
"@tauri-apps/plugin-os": ["@tauri-apps/[email protected]", "", { "dependencies": { "@tauri-apps/api": "^2.8.0" } }, "sha512-ty5V8XDUIFbSnrk3zsFoP3kzN+vAufYzalJSlmrVhQTImIZa1aL1a03bOaP2vuBvfR+WDRC6NgV2xBl8G07d+w=="],
diff --git a/js/app/packages/app/package.json b/js/app/packages/app/package.json
index 5e3598abd3..022298973f 100644
--- a/js/app/packages/app/package.json
+++ b/js/app/packages/app/package.json
@@ -25,8 +25,9 @@
"ddupload:prod": "datadog-ci sourcemaps upload ./dist --service web-app --release-version $WEB_APP_VERSION --minified-path-prefix https://macro.com/app"
},
"dependencies": {
- "@types/three": "^0.178.0",
"@macro/tauri": "workspace:*",
+ "@tauri-apps/plugin-log": "^2.7.1",
+ "@types/three": "^0.178.0",
"core": "workspace:*",
"mermaid": "^11.6.0",
"overlayscrollbars-solid": "^0.5.5",
diff --git a/js/app/tauri/src-tauri/capabilities/default.json b/js/app/tauri/src-tauri/capabilities/default.json
index 8fdbfb5502..00bdd4f3c6 100644
--- a/js/app/tauri/src-tauri/capabilities/default.json
+++ b/js/app/tauri/src-tauri/capabilities/default.json
@@ -33,6 +33,7 @@
"safe-area-insets:default",
"notification:default",
"notifications:default",
- "os:default"
+ "os:default",
+ "log:default"
]
}
\ No newline at end of file
diff --git a/js/app/tauri/src-tauri/capabilities/mobile.json b/js/app/tauri/src-tauri/capabilities/mobile.json
index defab0d9e0..91e227a8f4 100644
--- a/js/app/tauri/src-tauri/capabilities/mobile.json
+++ b/js/app/tauri/src-tauri/capabilities/mobile.json
@@ -11,6 +11,7 @@
"haptics:allow-impact-feedback",
"haptics:allow-notification-feedback",
"haptics:allow-selection-feedback",
- "haptics:allow-vibrate"
+ "haptics:allow-vibrate",
+ "log:default"
]
-}
+}
\ No newline at end of file
diff --git a/js/app/tauri/src-tauri/src/lib.rs b/js/app/tauri/src-tauri/src/lib.rs
index aac136d042..8aa907bb52 100644
--- a/js/app/tauri/src-tauri/src/lib.rs
+++ b/js/app/tauri/src-tauri/src/lib.rs
@@ -47,7 +47,9 @@ pub fn run() {
.with_line_number(true)
.pretty();
- let registry = tracing_subscriber::registry().with(filter).with(fmt_layer);
+ let registry = tracing_subscriber::registry()
+ .with(filter)
+ .with(fmt_layer);
#[cfg(target_os = "ios")]
let registry = registry.with(tracing_oslog::OsLogger::new(
@@ -57,7 +59,7 @@ pub fn run() {
registry.init();
- let mut builder = tauri::Builder::default().plugin(tauri_plugin_haptics::init());
+ let mut builder = tauri::Builder::default();
#[cfg(desktop)]
{
@@ -68,10 +70,22 @@ pub fn run() {
}))
}
+ #[cfg(target_os = "ios")]
+ {
+ builder = builder.plugin(tauri_plugin_haptics::init());
+ }
+
// register the rest of the common plugins
+ // The log plugin with "tracing" feature emits tracing::event! directly,
+ // so logs from the webview will go through our tracing subscriber
builder = builder
.plugin(tauri_plugin_deep_link::init())
- .plugin(tauri_plugin_log::Builder::default().skip_logger().build())
+ .plugin(
+ tauri_plugin_log::Builder::default()
+ .level(log::LevelFilter::Debug)
+ .skip_logger() // Don't set up log crate logger, we only want the tracing events
+ .build(),
+ )
.plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_os::init())
.plugin(tauri_plugin_http::init())