From 3d4837c4449e9d7571351c32a7ef989f0efd2a2f Mon Sep 17 00:00:00 2001 From: Graeme Coupar Date: Thu, 23 May 2024 12:04:32 +0100 Subject: [PATCH] fix: swap no-logging feature for logging feature Having a subtractive feature like no-logging was causing compile errors to be missed in CI, which is not good. --- Cargo.toml | 8 ++++---- src/logging.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c594b69..b672038 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,17 +19,17 @@ members = ["examples", "examples-wasm"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -default = [] +default = ["logging"] +logging = ["dep:log"] async-tungstenite = ["tungstenite"] client-cynic = ["cynic"] client-graphql-client = ["graphql_client"] -ws_stream_wasm = ["dep:ws_stream_wasm", "no-logging", "pharos", "pin-project-lite"] -no-logging = [] +ws_stream_wasm = ["dep:ws_stream_wasm", "pharos", "pin-project-lite"] [dependencies] async-trait = "0.1" futures = "0.3" -log = "0.4" +log = { version = "0.4", optional = true } pin-project = "1" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/src/logging.rs b/src/logging.rs index 3d0fd93..c6a85c9 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -1,16 +1,16 @@ -#[cfg(not(feature = "no-logging"))] +#[cfg(all(feature = "logging", not(target_arch = "wasm32")))] macro_rules! trace { ($($arg:tt)+) => ( log::trace!(target: "graphql-ws-client", $($arg)+) ) } -#[cfg(feature = "no-logging")] +#[cfg(any(not(feature = "logging"), target_arch = "wasm32"))] macro_rules! trace { ($($t:tt)*) => {}; } -#[cfg(not(feature = "no-logging"))] +#[cfg(all(feature = "logging", not(target_arch = "wasm32")))] #[allow(unused_macros)] macro_rules! warning { ($($arg:tt)+) => ( @@ -18,7 +18,7 @@ macro_rules! warning { ) } -#[cfg(feature = "no-logging")] +#[cfg(any(not(feature = "logging"), target_arch = "wasm32"))] #[allow(unused_macros)] macro_rules! warning { ($($t:tt)*) => {};