From 9d849d22341a61777dea6b417fbac9bfe077c33c Mon Sep 17 00:00:00 2001 From: neuronull <9162534+neuronull@users.noreply.github.com> Date: Mon, 27 Oct 2025 06:39:40 -0700 Subject: [PATCH] Convert `log` crate Records to `tracing` Events for desktop native. (#16827) * Convert `log` crate Records to `tracing` Events for desktop native. * sort deps * use the feature on tracing_subscriber --- apps/desktop/desktop_native/Cargo.toml | 2 +- apps/desktop/desktop_native/napi/src/lib.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/desktop/desktop_native/Cargo.toml b/apps/desktop/desktop_native/Cargo.toml index c0fe0b46f58..2168eaa0068 100644 --- a/apps/desktop/desktop_native/Cargo.toml +++ b/apps/desktop/desktop_native/Cargo.toml @@ -68,7 +68,7 @@ tokio = "=1.45.0" tokio-stream = "=0.1.15" tokio-util = "=0.7.13" tracing = "=0.1.41" -tracing-subscriber = { version = "=0.3.20", features = ["fmt", "env-filter"] } +tracing-subscriber = { version = "=0.3.20", features = ["fmt", "env-filter", "tracing-log"] } typenum = "=1.18.0" uniffi = "=0.28.3" widestring = "=1.2.0" diff --git a/apps/desktop/desktop_native/napi/src/lib.rs b/apps/desktop/desktop_native/napi/src/lib.rs index a193e44d6df..09f63f7854b 100644 --- a/apps/desktop/desktop_native/napi/src/lib.rs +++ b/apps/desktop/desktop_native/napi/src/lib.rs @@ -1051,6 +1051,10 @@ pub mod logging { // overriding the default directive for matching targets. .from_env_lossy(); + // With the `tracing-log` feature enabled for the `tracing_subscriber`, + // the registry below will initialize a log compatibility layer, which allows + // the subscriber to consume log::Records as though they were tracing Events. + // https://docs.rs/tracing-subscriber/latest/tracing_subscriber/util/trait.SubscriberInitExt.html#method.init tracing_subscriber::registry() .with(filter) .with(JsLayer)