1
0
mirror of https://github.com/bitwarden/browser synced 2026-03-02 19:41:26 +00:00

[BEEEP] Use tracing in macOS provider

This commit is contained in:
neuronull
2025-10-03 10:51:10 -06:00
parent 7a38b22667
commit 733ba46bfc
3 changed files with 32 additions and 4 deletions

View File

@@ -1793,13 +1793,14 @@ version = "0.0.0"
dependencies = [
"desktop_core",
"futures",
"log",
"oslog",
"serde",
"serde_json",
"tokio",
"tokio-util",
"tracing",
"tracing-oslog",
"tracing-subscriber",
"uniffi",
]
@@ -3445,6 +3446,18 @@ dependencies = [
"tracing-core",
]
[[package]]
name = "tracing-oslog"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d76902d2a8d5f9f55a81155c08971734071968c90f2d9bfe645fe700579b2950"
dependencies = [
"cc",
"cfg-if",
"tracing-core",
"tracing-subscriber",
]
[[package]]
name = "tracing-subscriber"
version = "0.3.20"

View File

@@ -16,12 +16,13 @@ bench = false
[dependencies]
desktop_core = { path = "../core" }
futures = { workspace = true }
log = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
tokio = { workspace = true, features = ["sync"] }
tokio-util = { workspace = true }
tracing = { workspace = true }
tracing-oslog = "0.3.0"
tracing-subscriber = { workspace = true }
uniffi = { workspace = true, features = ["cli"] }
[target.'cfg(target_os = "macos")'.dependencies]

View File

@@ -9,6 +9,11 @@ use std::{
use futures::FutureExt;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use tracing::{error, info};
use tracing_subscriber::{
filter::{EnvFilter, LevelFilter},
layer::SubscriberExt,
util::SubscriberInitExt,
};
uniffi::setup_scaffolding!();
@@ -65,8 +70,17 @@ impl MacOSProviderClient {
#[allow(clippy::unwrap_used)]
#[uniffi::constructor]
pub fn connect() -> Self {
let _ = oslog::OsLogger::new("com.bitwarden.desktop.autofill-extension")
.level_filter(log::LevelFilter::Trace)
let filter = EnvFilter::builder()
// Everything logs at `TRACE`
.with_default_directive(LevelFilter::TRACE.into())
.from_env_lossy();
tracing_subscriber::registry()
.with(filter)
.with(tracing_oslog::OsLogger::new(
"com.bitwarden.desktop.autofill-extension",
"default",
))
.init();
let (from_server_send, mut from_server_recv) = tokio::sync::mpsc::channel(32);