Skip to content

Commit 3018138

Browse files
authored
refactor: Use tracing to replace log (#1183)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> - Closes #482 ## What changes are included in this PR? Using `tracing` to replace `log` in the whole worksapce. ## Are these changes tested? <!-- Specify what test covers (unit test, integration test, etc.). If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> --------- Signed-off-by: Xuanwo <github@xuanwo.io>
1 parent 4531203 commit 3018138

File tree

12 files changed

+29
-113
lines changed

12 files changed

+29
-113
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ chrono = "0.4.38"
6161
ctor = "0.2.8"
6262
datafusion = "45"
6363
derive_builder = "0.20"
64-
env_logger = "0.11.0"
6564
expect-test = "1"
6665
fnv = "1.0.7"
6766
futures = "0.3"
@@ -72,7 +71,6 @@ iceberg-catalog-memory = { version = "0.4.0", path = "./crates/catalog/memory" }
7271
iceberg-catalog-rest = { version = "0.4.0", path = "./crates/catalog/rest" }
7372
iceberg-datafusion = { version = "0.4.0", path = "./crates/integrations/datafusion" }
7473
itertools = "0.13"
75-
log = "0.4.22"
7674
mockito = "1"
7775
murmur3 = "0.5.2"
7876
num-bigint = "0.4.6"
@@ -98,6 +96,8 @@ tempfile = "3.18"
9896
tera = "1"
9997
thrift = "0.17.0"
10098
tokio = { version = "1.44", default-features = false }
99+
tracing = "0.1.37"
100+
tracing-subscriber = "0.3.8"
101101
typed-builder = "0.20"
102102
url = "2.5.4"
103103
uuid = { version = "1.14", features = ["v7"] }

crates/catalog/glue/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ async-trait = { workspace = true }
3434
aws-config = { workspace = true }
3535
aws-sdk-glue = { workspace = true }
3636
iceberg = { workspace = true }
37-
log = { workspace = true }
3837
serde_json = { workspace = true }
3938
tokio = { workspace = true }
39+
tracing = { workspace = true }
4040
typed-builder = { workspace = true }
4141
uuid = { workspace = true }
4242

crates/catalog/glue/tests/glue_catalog_test.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use iceberg_test_utils::docker::DockerCompose;
3232
use iceberg_test_utils::{normalize_test_name, set_up};
3333
use port_scanner::scan_port_addr;
3434
use tokio::time::sleep;
35+
use tracing::info;
3536

3637
const GLUE_CATALOG_PORT: u16 = 5000;
3738
const MINIO_PORT: u16 = 9000;
@@ -68,7 +69,7 @@ async fn get_catalog() -> GlueCatalog {
6869
let glue_socket_addr = SocketAddr::new(glue_catalog_ip, GLUE_CATALOG_PORT);
6970
let minio_socket_addr = SocketAddr::new(minio_ip, MINIO_PORT);
7071
while !scan_port_addr(glue_socket_addr) {
71-
log::info!("Waiting for 1s glue catalog to ready...");
72+
info!("Waiting for 1s glue catalog to ready...");
7273
sleep(std::time::Duration::from_millis(1000)).await;
7374
}
7475

crates/catalog/hms/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ async-trait = { workspace = true }
3434
chrono = { workspace = true }
3535
hive_metastore = { workspace = true }
3636
iceberg = { workspace = true }
37-
log = { workspace = true }
3837
pilota = { workspace = true }
3938
serde_json = { workspace = true }
4039
tokio = { workspace = true }
40+
tracing = { workspace = true }
4141
typed-builder = { workspace = true }
4242
uuid = { workspace = true }
4343
volo-thrift = { workspace = true }

crates/catalog/hms/tests/hms_catalog_test.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use iceberg_test_utils::docker::DockerCompose;
3030
use iceberg_test_utils::{normalize_test_name, set_up};
3131
use port_scanner::scan_port_addr;
3232
use tokio::time::sleep;
33+
use tracing::info;
3334

3435
const HMS_CATALOG_PORT: u16 = 9083;
3536
const MINIO_PORT: u16 = 9000;
@@ -67,8 +68,8 @@ async fn get_catalog() -> HmsCatalog {
6768
let hms_socket_addr = SocketAddr::new(hms_catalog_ip, HMS_CATALOG_PORT);
6869
let minio_socket_addr = SocketAddr::new(minio_ip, MINIO_PORT);
6970
while !scan_port_addr(hms_socket_addr) {
70-
log::info!("scan hms_socket_addr {} check", hms_socket_addr);
71-
log::info!("Waiting for 1s hms catalog to ready...");
71+
info!("scan hms_socket_addr {} check", hms_socket_addr);
72+
info!("Waiting for 1s hms catalog to ready...");
7273
sleep(std::time::Duration::from_millis(1000)).await;
7374
}
7475

crates/catalog/rest/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ chrono = { workspace = true }
3535
http = { workspace = true }
3636
iceberg = { workspace = true }
3737
itertools = { workspace = true }
38-
log = { workspace = true }
3938
reqwest = { workspace = true }
4039
serde = { workspace = true }
4140
serde_derive = { workspace = true }
4241
serde_json = { workspace = true }
4342
tokio = { workspace = true, features = ["sync"] }
43+
tracing = { workspace = true }
4444
typed-builder = { workspace = true }
4545
uuid = { workspace = true, features = ["v4"] }
4646

crates/catalog/rest/tests/rest_catalog_test.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use iceberg_test_utils::docker::DockerCompose;
3030
use iceberg_test_utils::{normalize_test_name, set_up};
3131
use port_scanner::scan_port_addr;
3232
use tokio::time::sleep;
33+
use tracing::info;
3334

3435
const REST_CATALOG_PORT: u16 = 8181;
3536
static DOCKER_COMPOSE_ENV: RwLock<Option<DockerCompose>> = RwLock::new(None);
@@ -62,7 +63,7 @@ async fn get_catalog() -> RestCatalog {
6263

6364
let rest_socket_addr = SocketAddr::new(rest_catalog_ip, REST_CATALOG_PORT);
6465
while !scan_port_addr(rest_socket_addr) {
65-
log::info!("Waiting for 1s rest catalog to ready...");
66+
info!("Waiting for 1s rest catalog to ready...");
6667
sleep(std::time::Duration::from_millis(1000)).await;
6768
}
6869

crates/test_utils/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ license = { workspace = true }
2626
repository = { workspace = true }
2727

2828
[dependencies]
29-
env_logger = { workspace = true }
30-
log = { workspace = true }
29+
tracing = { workspace = true }
30+
tracing-subscriber = { workspace = true }
3131

3232
[features]
3333
tests = []

crates/test_utils/src/cmd.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,27 @@
1717

1818
use std::process::Command;
1919

20+
use tracing::info;
21+
2022
pub fn run_command(mut cmd: Command, desc: impl ToString) {
2123
let desc = desc.to_string();
22-
log::info!("Starting to {}, command: {:?}", &desc, cmd);
24+
info!("Starting to {}, command: {:?}", &desc, cmd);
2325
let exit = cmd.status().unwrap();
2426
if exit.success() {
25-
log::info!("{} succeed!", desc)
27+
info!("{} succeed!", desc)
2628
} else {
2729
panic!("{} failed: {:?}", desc, exit);
2830
}
2931
}
3032

3133
pub fn get_cmd_output_result(mut cmd: Command, desc: impl ToString) -> Result<String, String> {
3234
let desc = desc.to_string();
33-
log::info!("Starting to {}, command: {:?}", &desc, cmd);
35+
info!("Starting to {}, command: {:?}", &desc, cmd);
3436
let result = cmd.output();
3537
match result {
3638
Ok(output) => {
3739
if output.status.success() {
38-
log::info!("{} succeed!", desc);
40+
info!("{} succeed!", desc);
3941
Ok(String::from_utf8(output.stdout).unwrap())
4042
} else {
4143
Err(format!("{} failed with rc: {:?}", desc, output.status))

0 commit comments

Comments
 (0)