From b9031bbbece1988c1de180cabbf4e3acfcb50836 Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Wed, 3 May 2023 10:33:29 +0400 Subject: [PATCH] fix: added missing log4rs features (#5356) Description --- Added missing log4rs features to applications which use these features. Motivation and Context --- Base node panics because the sample log config uses a number of log4rs features that are not compiled in. The dependency was not added to the common lib as this adds extra dependencies to a lot of libs and it breaks wasm build. How Has This Been Tested? --- Base node runs What process can a PR reviewer use to test or verify this change? --- Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify --- Cargo.lock | 3 +++ applications/tari_base_node/Cargo.toml | 7 +++++++ applications/tari_console_wallet/Cargo.toml | 4 +++- applications/tari_miner/Cargo.toml | 7 +++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 82ba01c249..7d1571f4dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5173,6 +5173,7 @@ dependencies = [ "futures 0.3.26", "log", "log-mdc", + "log4rs", "nom 7.1.3", "qrcode", "rustyline", @@ -5469,6 +5470,7 @@ dependencies = [ "digest 0.9.0", "futures 0.3.26", "log", + "log4rs", "qrcode", "rand 0.7.3", "regex", @@ -5804,6 +5806,7 @@ dependencies = [ "futures 0.3.26", "hex", "log", + "log4rs", "native-tls", "num_cpus", "prost-types 0.9.0", diff --git a/applications/tari_base_node/Cargo.toml b/applications/tari_base_node/Cargo.toml index 9187cd5d66..bb2ab0093a 100644 --- a/applications/tari_base_node/Cargo.toml +++ b/applications/tari_base_node/Cargo.toml @@ -38,6 +38,7 @@ futures = { version = "^0.3.16", default-features = false, features = ["alloc"] qrcode = { version = "0.12" } log = { version = "0.4.8", features = ["std"] } log-mdc = "0.1.0" +log4rs = { version = "1.2.0", default_features = false, features = ["config_parsing", "threshold_filter", "yaml_format", "console_appender", "rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller"] } nom = "7.1.0" rustyline = "9.0" rustyline-derive = "0.5" @@ -59,3 +60,9 @@ libtor = ["tari_libtor"] [build-dependencies] tari_features = { version = "0.50.0-pre.0", path = "../../common/tari_features"} + +[package.metadata.cargo-machete] +ignored = [ + # We need to specify extra features for log4rs even though it is not used directly in this crate + "log4rs" +] diff --git a/applications/tari_console_wallet/Cargo.toml b/applications/tari_console_wallet/Cargo.toml index aeb866a3a5..ba4637e0f1 100644 --- a/applications/tari_console_wallet/Cargo.toml +++ b/applications/tari_console_wallet/Cargo.toml @@ -35,6 +35,7 @@ config = "0.13.0" crossterm = { version = "0.25.0" } digest = "0.9.0" futures = { version = "^0.3.16", default-features = false, features = ["alloc"] } +log4rs = { version = "1.2.0", default_features = false, features = ["config_parsing", "threshold_filter", "yaml_format", "console_appender", "rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller"] } log = { version = "0.4.8", features = ["std"] } qrcode = { version = "0.12" } rand = "0.7.3" @@ -71,4 +72,5 @@ avx2 = ["tari_core/avx2", "tari_crypto/simd_backend", "tari_wallet/avx2", "tari_ libtor = ["tari_libtor"] [package.metadata.cargo-machete] -ignored = ["strum"] \ No newline at end of file +# We need to specify extra features for log4rs even though it is not used directly in this crate +ignored = ["strum", "log4rs"] diff --git a/applications/tari_miner/Cargo.toml b/applications/tari_miner/Cargo.toml index 81f1b67077..5090d8c1d8 100644 --- a/applications/tari_miner/Cargo.toml +++ b/applications/tari_miner/Cargo.toml @@ -23,6 +23,7 @@ clap = { version = "3.1.1", features = ["derive"] } crossbeam = "0.8" futures = "0.3" log = { version = "0.4", features = ["std"] } +log4rs = { version = "1.2.0", default_features = false, features = ["config_parsing", "threshold_filter", "yaml_format", "console_appender", "rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller"] } num_cpus = "1.13" rand = "0.7.3" serde = { version = "1.0", default_features = false, features = ["derive"] } @@ -41,3 +42,9 @@ base64 = "0.13.0" prost-types = "0.9" chrono = { version = "0.4.19", default-features = false } config = "0.13.0" + +[package.metadata.cargo-machete] +ignored = [ + # We need to specify extra features for log4rs even though it is not used directly in this crate + "log4rs" +]