1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-05 11:13:44 +00:00

convert existing log macros to tracing

This commit is contained in:
neuronull
2025-09-15 20:26:46 -06:00
parent ddf0462949
commit bb43a400d5
6 changed files with 11 additions and 17 deletions

View File

@@ -460,7 +460,6 @@ dependencies = [
"cbc",
"hex",
"homedir",
"log",
"oo7",
"pbkdf2",
"rand 0.9.1",
@@ -915,7 +914,6 @@ dependencies = [
"interprocess",
"keytar",
"libc",
"log",
"oo7",
"pin-project",
"pkcs8",
@@ -954,7 +952,6 @@ dependencies = [
"bitwarden_chromium_importer",
"desktop_core",
"hex",
"log",
"napi",
"napi-build",
"napi-derive",

View File

@@ -14,7 +14,6 @@ base64 = { workspace = true }
cbc = { workspace = true, features = ["alloc"] }
hex = { workspace = true }
homedir = { workspace = true }
log = { workspace = true }
pbkdf2 = "=0.12.2"
rand = { workspace = true }
rusqlite = { version = "=0.35.0", features = ["bundled"] }

View File

@@ -31,7 +31,6 @@ ed25519 = { workspace = true, features = ["pkcs8"] }
futures = { workspace = true }
homedir = { workspace = true }
interprocess = { workspace = true, features = ["tokio"] }
log = { workspace = true }
pin-project = { workspace = true }
pkcs8 = { workspace = true, features = ["alloc", "encryption", "pem"] }
rand = { workspace = true }

View File

@@ -5,21 +5,21 @@ use interprocess::local_socket::{
tokio::{prelude::*, Stream},
GenericFilePath, ToFsName,
};
use log::{error, info};
use tracing::{error, info};
pub async fn connect(
path: PathBuf,
send: tokio::sync::mpsc::Sender<String>,
mut recv: tokio::sync::mpsc::Receiver<String>,
) -> Result<(), Box<dyn std::error::Error>> {
info!("Attempting to connect to {}", path.display());
info!(?path, "Attempting to connect");
let name = path.as_os_str().to_fs_name::<GenericFilePath>()?;
let conn = Stream::connect(name).await?;
let mut conn = crate::ipc::internal_ipc_codec(conn);
info!("Connected to {}", path.display());
info!(?path, "Connected");
// This `connected` and the latter `disconnected` messages are the only ones that
// are sent from the Rust IPC code and not just forwarded from the desktop app.
@@ -46,7 +46,7 @@ pub async fn connect(
res = conn.next() => {
match res {
Some(Err(e)) => {
error!("Error reading from IPC server: {e}");
error!(error = %e, "Error reading from IPC server");
break;
}
None => {

View File

@@ -7,12 +7,12 @@ use futures::{SinkExt, StreamExt, TryFutureExt};
use anyhow::Result;
use interprocess::local_socket::{tokio::prelude::*, GenericFilePath, ListenerOptions};
use log::{error, info};
use tokio::{
io::{AsyncRead, AsyncWrite},
sync::{broadcast, mpsc},
};
use tokio_util::sync::CancellationToken;
use tracing::{error, info};
use super::MESSAGE_CHANNEL_BUFFER;
@@ -143,11 +143,11 @@ async fn listen_incoming(
client_id
);
tokio::spawn(future.map_err(|e| {
error!("Error handling connection: {}", e)
error!(error = %e, "Error handling connection")
}));
},
Err(e) => {
error!("Error accepting connection: {}", e);
error!(error = %e, "Error accepting connection");
break;
},
}
@@ -176,7 +176,7 @@ async fn handle_connection(
loop {
tokio::select! {
_ = cancel_token.cancelled() => {
info!("Client {client_id} cancelled.");
info!(client_id, "Client cancelled.");
break;
},
@@ -187,7 +187,7 @@ async fn handle_connection(
client_stream.send(msg.into()).await?;
},
Err(e) => {
info!("Error reading message: {}", e);
error!(error = %e, "Error reading message");
break;
}
}
@@ -199,7 +199,7 @@ async fn handle_connection(
result = client_stream.next() => {
match result {
Some(Err(e)) => {
info!("Error reading from client {client_id}: {e}");
error!(client_id, error = %e, "Error reading from client");
client_to_server_send.send(Message {
client_id,
@@ -209,7 +209,7 @@ async fn handle_connection(
break;
},
None => {
info!("Client {client_id} disconnected.");
info!(client_id, "Client disconnected.");
client_to_server_send.send(Message {
client_id,

View File

@@ -20,7 +20,6 @@ base64 = { workspace = true }
bitwarden_chromium_importer = { path = "../bitwarden_chromium_importer" }
desktop_core = { path = "../core" }
hex = { workspace = true }
log = { workspace = true }
napi = { workspace = true, features = ["async"] }
napi-derive = { workspace = true }
serde = { workspace = true, features = ["derive"] }