From cdd13fb9f022a4da7a64bf92e53d6f802279c1fa Mon Sep 17 00:00:00 2001 From: Fred Clausen <43556888+fredclausen@users.noreply.github.com> Date: Thu, 7 Dec 2023 06:14:41 -0700 Subject: [PATCH] Implement sdre rust logging changes to use the string instead of u8 --- Cargo.lock | 12 ++++++------ rootfs/etc/s6-overlay/scripts/acars_router | 6 ------ rust/bin/acars_router/Cargo.toml | 2 +- rust/libraries/acars_config/Cargo.toml | 4 ++-- rust/libraries/acars_config/src/lib.rs | 6 +++--- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index be9a9362..498bd82e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -257,9 +257,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.10" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fffed7514f420abec6d183b1d3acfd9099c79c3a10a06ade4f8203f1411272" +checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" dependencies = [ "clap_builder", "clap_derive", @@ -267,9 +267,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.9" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63361bae7eef3771745f02d8d892bec2fee5f6e34af316ba556e7f97a7069ff1" +checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" dependencies = [ "anstream", "anstyle", @@ -946,9 +946,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sdre-rust-logging" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9df79503a8e48757ac5dd1a10517b7fde74bea8d4223cbb910db508bc8a96ee2" +checksum = "78cb771c3ce3d5ff02f2ec4e9c98693a7212e98e81f97eb8c6cf26343fb0a09e" dependencies = [ "chrono", "env_logger", diff --git a/rootfs/etc/s6-overlay/scripts/acars_router b/rootfs/etc/s6-overlay/scripts/acars_router index 49e07fa4..1e42b918 100755 --- a/rootfs/etc/s6-overlay/scripts/acars_router +++ b/rootfs/etc/s6-overlay/scripts/acars_router @@ -3,12 +3,6 @@ AR_COMMAND=() -if [[ ${AR_VERBOSITY,,} =~ debug || $AR_VERBOSITY -eq 1 ]]; then - AR_COMMAND+=("-v") -elif [[ ${AR_VERBOSITY,,} =~ trace || $AR_VERBOSITY -ge 2 ]]; then - AR_COMMAND+=("-vv") -fi - # ACARS Input if [[ -n $AR_LISTEN_UDP_ACARS ]]; then diff --git a/rust/bin/acars_router/Cargo.toml b/rust/bin/acars_router/Cargo.toml index d211e380..0e0d2611 100644 --- a/rust/bin/acars_router/Cargo.toml +++ b/rust/bin/acars_router/Cargo.toml @@ -19,5 +19,5 @@ serde = { version = "1.0.193", features = ["derive"] } serde_json = "1.0.108" failure = "0.1.8" acars_config = { path = "../../libraries/acars_config" } -sdre-rust-logging = "0.1.0" +sdre-rust-logging = "0.2.0" acars_connection_manager = { path = "../../libraries/acars_connection_manager" } diff --git a/rust/libraries/acars_config/Cargo.toml b/rust/libraries/acars_config/Cargo.toml index fd714a6e..34414583 100644 --- a/rust/libraries/acars_config/Cargo.toml +++ b/rust/libraries/acars_config/Cargo.toml @@ -6,6 +6,6 @@ edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -clap = { version = "4.4.10", features = ["derive", "env"] } +clap = { version = "4.4.11", features = ["derive", "env"] } log = "0.4.20" -sdre-rust-logging = "0.1.0" +sdre-rust-logging = "0.2.0" diff --git a/rust/libraries/acars_config/src/lib.rs b/rust/libraries/acars_config/src/lib.rs index 55ecaf3b..f3841e3d 100644 --- a/rust/libraries/acars_config/src/lib.rs +++ b/rust/libraries/acars_config/src/lib.rs @@ -13,8 +13,8 @@ use sdre_rust_logging::SetupLogging; pub struct Input { // Output Options /// Set the log level. debug, trace, info are valid options. - #[clap(short, long, action = clap::ArgAction::Count)] - pub verbose: u8, + #[clap(short, long, env = "AR_VERBOSE", value_parser, default_value = "info")] + pub verbose: String, /// Enable message deduplication #[clap(long, env = "AR_ENABLE_DEDUPE", value_parser)] pub enable_dedupe: bool, @@ -128,7 +128,7 @@ impl Input { debug!("AR_SEND_TCP_ACARS: {:?}", self.send_tcp_acars); debug!("AR_SERVE_TCP_ACARS: {:?}", self.serve_tcp_acars); debug!("AR_SERVE_ZMQ_ACARS: {:?}", self.serve_zmq_acars); - debug!("AR_VERBOSE: {:?}", self.verbose.set_logging_level()); + debug!("AR_VERBOSE: {:?}", self.verbose.clone().set_logging_level()); debug!("AR_ADD_PROXY_ID: {:?}", self.add_proxy_id); debug!("AR_ENABLE_DEDUPE: {:?}", self.enable_dedupe); debug!("AR_DEDUPE_WINDOW: {:?}", self.dedupe_window);