Skip to content

Commit d05b2ae

Browse files
authored
Replace log with tracing (#573)
## 🎟️ Tracking https://bitwarden.atlassian.net/browse/PM-27519 ## 📔 Objective Cascading the standardization of `tracing` crate from clients repo into the SDK, that was started per bitwarden/clients#16321 , this change updates the remaining crates in the SDK to use `tracing`. ## 🚨 Breaking Changes <!-- Does this PR introduce any breaking changes? If so, please describe the impact and migration path for clients. If you're unsure, the automated TypeScript compatibility check will run when you open/update this PR and provide feedback. For breaking changes: 1. Describe what changed in the client interface 2. Explain why the change was necessary 3. Provide migration steps for client developers 4. Link to any paired client PRs if needed Otherwise, you can remove this section. --> ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
1 parent 6a31cf6 commit d05b2ae

File tree

24 files changed

+86
-69
lines changed

24 files changed

+86
-69
lines changed

Cargo.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ data-encoding = ">=2.0, <3"
5858
ed25519-dalek = { version = ">=2.1.1, <=2.2.0" }
5959
futures = ">=0.3.31, <0.4"
6060
js-sys = { version = ">=0.3.72, <0.4" }
61-
log = ">=0.4.18, <0.5"
6261
proc-macro2 = ">=1.0.89, <2"
6362
quote = ">=1.0.37, <2"
6463
reqwest = { version = ">=0.12.5, <0.13", features = [

bitwarden_license/bitwarden-sm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ bitwarden-api-api = { workspace = true }
1818
bitwarden-core = { workspace = true, features = ["secrets"] }
1919
bitwarden-crypto = { workspace = true }
2020
chrono = { workspace = true }
21-
log = { workspace = true }
2221
schemars = { workspace = true }
2322
serde = { workspace = true }
2423
serde_json = { workspace = true }
2524
thiserror = { workspace = true }
25+
tracing = { workspace = true }
2626
uuid = { workspace = true }
2727
validator = { workspace = true }
2828

bitwarden_license/bitwarden-sm/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use bitwarden_api_api::apis::Error as ApiApisError;
2-
use log::debug;
32
use thiserror::Error;
3+
use tracing::debug;
44
use validator::ValidationErrors;
55

66
#[derive(Debug, thiserror::Error)]
@@ -45,7 +45,7 @@ pub fn validate_only_whitespaces(value: &str) -> Result<(), validator::Validatio
4545

4646
impl From<ValidationErrors> for ValidationError {
4747
fn from(e: ValidationErrors) -> Self {
48-
debug!("Validation errors: {e:#?}");
48+
debug!(?e, "Validation errors");
4949
for (field_name, errors) in e.field_errors() {
5050
for error in errors {
5151
match error.code.as_ref() {

crates/bitwarden-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ bitwarden-uuid = { workspace = true }
4949
chrono = { workspace = true, features = ["std"] }
5050
# We don't use this directly (it's used by rand), but we need it here to enable WASM support
5151
getrandom = { version = ">=0.2.9, <0.3", features = ["js"] }
52-
log = { workspace = true }
5352
rand = ">=0.8.5, <0.9"
5453
reqwest = { workspace = true }
5554
schemars = { workspace = true }
@@ -59,6 +58,7 @@ serde_json = { workspace = true }
5958
serde_qs = { workspace = true }
6059
serde_repr = { workspace = true }
6160
thiserror = { workspace = true }
61+
tracing = { workspace = true }
6262
tsify = { workspace = true, optional = true }
6363
uniffi = { workspace = true, optional = true, features = ["tokio"] }
6464
uuid = { workspace = true }

crates/bitwarden-core/src/auth/api/request/access_token_request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use log::debug;
21
use serde::{Deserialize, Serialize};
2+
use tracing::debug;
33
use uuid::Uuid;
44

55
use crate::{
@@ -23,7 +23,7 @@ impl AccessTokenRequest {
2323
client_secret: client_secret.to_string(),
2424
grant_type: "client_credentials".to_string(),
2525
};
26-
debug!("initializing {obj:?}");
26+
debug!(?obj, "initializing");
2727
obj
2828
}
2929

crates/bitwarden-core/src/auth/api/request/api_token_request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use log::debug;
21
use serde::{Deserialize, Serialize};
2+
use tracing::debug;
33

44
use crate::{
55
auth::{api::response::IdentityTokenResponse, login::LoginError},
@@ -31,7 +31,7 @@ impl ApiTokenRequest {
3131
device_name: "firefox".to_string(),
3232
grant_type: "client_credentials".to_string(),
3333
};
34-
debug!("initializing {obj:?}");
34+
debug!(?obj, "initializing");
3535
obj
3636
}
3737

crates/bitwarden-core/src/auth/api/request/auth_request_token_request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use log::debug;
21
use serde::{Deserialize, Serialize};
2+
use tracing::debug;
33
use uuid::Uuid;
44

55
use crate::{
@@ -47,7 +47,7 @@ impl AuthRequestTokenRequest {
4747
auth_request_id: *auth_request_id,
4848
access_code: access_code.to_string(),
4949
};
50-
debug!("initializing {obj:?}");
50+
debug!(?obj, "initializing");
5151
obj
5252
}
5353

crates/bitwarden-core/src/auth/api/request/password_token_request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use log::debug;
21
use serde::{Deserialize, Serialize};
2+
use tracing::debug;
33

44
use crate::{
55
DeviceType,
@@ -56,7 +56,7 @@ impl PasswordTokenRequest {
5656
two_factor_provider: tf.map(|t| t.provider.clone()),
5757
two_factor_remember: tf.map(|t| t.remember),
5858
};
59-
debug!("initializing {obj:?}");
59+
debug!(?obj, "initializing");
6060
obj
6161
}
6262

crates/bitwarden-core/src/auth/login/password.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#[cfg(feature = "internal")]
2-
use log::info;
31
use schemars::JsonSchema;
42
use serde::{Deserialize, Serialize};
3+
#[cfg(feature = "internal")]
4+
use tracing::info;
55

66
use crate::auth::{
77
api::response::IdentityTokenResponse, login::response::two_factor::TwoFactorProviders,

0 commit comments

Comments
 (0)