1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-03 10:13:31 +00:00

Explicitly initialize logging in macOS autofill extension

This commit is contained in:
Isaiah Inuwa
2025-12-30 09:52:12 -06:00
parent 8690c47cbb
commit 11715e169d
2 changed files with 20 additions and 16 deletions

View File

@@ -198,22 +198,6 @@ impl AutofillProviderClient {
///
/// See documentation at the top-level of [this struct][AutofillProviderClient] for usage information.
pub fn connect() -> Self {
#[cfg(target_os = "macos")]
INIT.call_once(|| {
let filter = EnvFilter::builder()
// Everything logs at `INFO`
.with_default_directive(LevelFilter::INFO.into())
.from_env_lossy();
tracing_subscriber::registry()
.with(filter)
.with(tracing_oslog::OsLogger::new(
"com.bitwarden.desktop.autofill-extension",
"default",
))
.init();
});
tracing::trace!("Autofill provider attempting to connect to Electron IPC...");
let (from_server_send, mut from_server_recv) = tokio::sync::mpsc::channel(32);
@@ -336,6 +320,25 @@ impl AutofillProviderClient {
}
}
#[cfg(target_os = "macos")]
#[uniffi::export]
pub fn initialize_logging() {
INIT.call_once(|| {
let filter = EnvFilter::builder()
// Everything logs at `INFO`
.with_default_directive(LevelFilter::INFO.into())
.from_env_lossy();
tracing_subscriber::registry()
.with(filter)
.with(tracing_oslog::OsLogger::new(
"com.bitwarden.desktop.autofill-extension",
"default",
))
.init();
});
}
#[derive(Serialize, Deserialize)]
#[serde(tag = "command", rename_all = "camelCase")]
enum CommandMessage {

View File

@@ -30,6 +30,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
return client
}
initializeLogging()
let logger = Logger(subsystem: "com.bitwarden.desktop.autofill-extension", category: "credential-provider")
// Check if the Electron app is running