mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
refactor: include binary name in crates_to_filter for logging (#1689)
This commit is contained in:
@ -20,7 +20,7 @@ All notable changes to HyperSwitch will be documented here.
|
||||
- Fix wallet payments throwing `Invalid 'payment_method_type' provided` and UI test issues ([#1633](https://github.com/juspay/hyperswitch/pull/1633)) ([`307a470`](https://github.com/juspay/hyperswitch/commit/307a470f7d838dc53df07a004ab89045ee0048ff))
|
||||
- Add Payment_Method_data in Redirection Form ([#1668](https://github.com/juspay/hyperswitch/pull/1668)) ([`b043ce6`](https://github.com/juspay/hyperswitch/commit/b043ce6130bf27f6279401ec98237aa91632480a))
|
||||
- **locker:** Remove delete_locker_payment_method_by_lookup_key from payments_operation_core ([#1636](https://github.com/juspay/hyperswitch/pull/1636)) ([`b326c18`](https://github.com/juspay/hyperswitch/commit/b326c18f45703724b1c22c69debd15ada841bf2e))
|
||||
- **middleware:** Inlcude `x-request-id` header in `access-control-expose-headers` header value ([#1673](https://github.com/juspay/hyperswitch/pull/1673)) ([`b1ae981`](https://github.com/juspay/hyperswitch/commit/b1ae981f82697f788d64bed146fd989a6eca16fe))
|
||||
- **middleware:** Include `x-request-id` header in `access-control-expose-headers` header value ([#1673](https://github.com/juspay/hyperswitch/pull/1673)) ([`b1ae981`](https://github.com/juspay/hyperswitch/commit/b1ae981f82697f788d64bed146fd989a6eca16fe))
|
||||
- **router:**
|
||||
- Use `Connector` enum for `connector_name` field in `MerchantConnectorCreate` ([#1637](https://github.com/juspay/hyperswitch/pull/1637)) ([`e750a73`](https://github.com/juspay/hyperswitch/commit/e750a7332376a60843dde9e71adfa76ce48fd154))
|
||||
- Remove requires_customer_action status to payment confirm ([#1624](https://github.com/juspay/hyperswitch/pull/1624)) ([`69454ec`](https://github.com/juspay/hyperswitch/commit/69454ec55c1392aee7a5215f7dc0c834fd6613d2))
|
||||
|
||||
195
Cargo.lock
generated
195
Cargo.lock
generated
@ -297,6 +297,12 @@ version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "adler32"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.7.6"
|
||||
@ -1160,6 +1166,12 @@ version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.4.3"
|
||||
@ -1276,6 +1288,12 @@ version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "checked_int_cast"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17cc5e6b5ab06331c33589842070416baa137e8b0eb912b008cfd4a78ada7919"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.26"
|
||||
@ -1333,6 +1351,12 @@ version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
|
||||
|
||||
[[package]]
|
||||
name = "color_quant"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
||||
|
||||
[[package]]
|
||||
name = "common_enums"
|
||||
version = "0.1.0"
|
||||
@ -1494,6 +1518,17 @@ dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.15"
|
||||
@ -1628,6 +1663,16 @@ version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eaa37046cc0f6c3cc6090fbdbf73ef0b8ef4cfcc37f6befc0020f63e8cf121e1"
|
||||
|
||||
[[package]]
|
||||
name = "deflate"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174"
|
||||
dependencies = [
|
||||
"adler32",
|
||||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_deref"
|
||||
version = "1.1.1"
|
||||
@ -1911,7 +1956,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
"miniz_oxide 0.7.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2199,6 +2244,16 @@ dependencies = [
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gif"
|
||||
version = "0.11.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06"
|
||||
dependencies = [
|
||||
"color_quant",
|
||||
"weezl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.17.2"
|
||||
@ -2464,6 +2519,25 @@ dependencies = [
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.23.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"byteorder",
|
||||
"color_quant",
|
||||
"gif",
|
||||
"jpeg-decoder",
|
||||
"num-iter",
|
||||
"num-rational",
|
||||
"num-traits",
|
||||
"png",
|
||||
"scoped_threadpool",
|
||||
"tiff",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.3"
|
||||
@ -2568,6 +2642,15 @@ dependencies = [
|
||||
"time 0.3.22",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jpeg-decoder"
|
||||
version = "0.1.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2"
|
||||
dependencies = [
|
||||
"rayon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.64"
|
||||
@ -2851,6 +2934,25 @@ version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435"
|
||||
dependencies = [
|
||||
"adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
|
||||
dependencies = [
|
||||
"adler",
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.1"
|
||||
@ -2965,6 +3067,28 @@ dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-iter"
|
||||
version = "0.1.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-rational"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.15"
|
||||
@ -3306,6 +3430,18 @@ version = "0.3.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.16.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"crc32fast",
|
||||
"deflate",
|
||||
"miniz_oxide 0.3.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "polling"
|
||||
version = "2.8.0"
|
||||
@ -3440,6 +3576,16 @@ dependencies = [
|
||||
"unicase",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "qrcode"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16d2f1455f3630c6e5107b4f2b94e74d76dea80736de0981fd27644216cff57f"
|
||||
dependencies = [
|
||||
"checked_int_cast",
|
||||
"image",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quanta"
|
||||
version = "0.11.1"
|
||||
@ -3581,6 +3727,28 @@ dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
|
||||
dependencies = [
|
||||
"either",
|
||||
"rayon-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon-core"
|
||||
version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils",
|
||||
"num_cpus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redis-protocol"
|
||||
version = "4.1.0"
|
||||
@ -3790,6 +3958,7 @@ dependencies = [
|
||||
"futures",
|
||||
"hex",
|
||||
"http",
|
||||
"image",
|
||||
"infer 0.13.0",
|
||||
"josekit",
|
||||
"jsonwebtoken",
|
||||
@ -3802,6 +3971,7 @@ dependencies = [
|
||||
"nanoid",
|
||||
"num_cpus",
|
||||
"once_cell",
|
||||
"qrcode",
|
||||
"rand 0.8.5",
|
||||
"redis_interface",
|
||||
"regex",
|
||||
@ -4032,6 +4202,12 @@ dependencies = [
|
||||
"parking_lot",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scoped_threadpool"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
@ -4615,6 +4791,17 @@ dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tiff"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a53f4706d65497df0c4349241deddf35f84cee19c87ed86ea8ca590f4464437"
|
||||
dependencies = [
|
||||
"jpeg-decoder",
|
||||
"miniz_oxide 0.4.4",
|
||||
"weezl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.1.45"
|
||||
@ -5341,6 +5528,12 @@ dependencies = [
|
||||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "weezl"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
||||
@ -7,6 +7,10 @@ pub mod logger {
|
||||
|
||||
/// Setup logging sub-system
|
||||
pub fn setup(conf: &config::Log) -> TelemetryGuard {
|
||||
router_env::setup(conf, router_env::service_name!(), [])
|
||||
router_env::setup(
|
||||
conf,
|
||||
router_env::service_name!(),
|
||||
[router_env::service_name!()],
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ async fn main() -> ApplicationResult<()> {
|
||||
conf.validate()
|
||||
.expect("Failed to validate router configuration");
|
||||
|
||||
let _guard = logger::setup(&conf.log);
|
||||
let _guard = logger::setup(&conf.log, [router_env::service_name!(), "actix_server"]);
|
||||
|
||||
logger::info!("Application started [{:?}] [{:?}]", conf.server, conf.log);
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ async fn main() -> CustomResult<(), errors::ProcessTrackerError> {
|
||||
redis_shutdown_signal_rx,
|
||||
tx.clone(),
|
||||
));
|
||||
let _guard = logger::setup(&state.conf.log);
|
||||
let _guard = logger::setup(&state.conf.log, [router_env::service_name!()]);
|
||||
|
||||
logger::debug!(startup_config=?state.conf);
|
||||
|
||||
|
||||
@ -5,7 +5,10 @@ pub mod logger {
|
||||
pub use router_env::{log, logger::*};
|
||||
|
||||
/// Setup logging sub-system.
|
||||
pub fn setup(conf: &config::Log) -> TelemetryGuard {
|
||||
router_env::setup(conf, router_env::service_name!(), ["actix_server"])
|
||||
pub fn setup(
|
||||
conf: &config::Log,
|
||||
crates_to_filter: impl AsRef<[&'static str]>,
|
||||
) -> TelemetryGuard {
|
||||
router_env::setup(conf, router_env::service_name!(), crates_to_filter)
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ readme = "README.md"
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
cargo_metadata = "0.15.4"
|
||||
config = { version = "0.13.3", features = ["toml"] }
|
||||
gethostname = "0.4.3"
|
||||
once_cell = "1.18.0"
|
||||
|
||||
@ -1,36 +1,14 @@
|
||||
include!("src/vergen.rs");
|
||||
mod vergen {
|
||||
include!("src/vergen.rs");
|
||||
}
|
||||
|
||||
mod cargo_workspace {
|
||||
include!("src/cargo_workspace.rs");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
generate_cargo_instructions();
|
||||
vergen::generate_cargo_instructions();
|
||||
|
||||
#[allow(clippy::expect_used)] // Safety: panicking in build scripts is okay for us
|
||||
let metadata = cargo_metadata::MetadataCommand::new()
|
||||
.exec()
|
||||
.expect("Failed to obtain cargo metadata");
|
||||
let workspace_members = metadata.workspace_members;
|
||||
|
||||
let package_id_entry_prefix =
|
||||
format!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
|
||||
assert!(
|
||||
workspace_members
|
||||
.iter()
|
||||
.any(|package_id| package_id.repr.starts_with(&package_id_entry_prefix)),
|
||||
"Unknown workspace members package ID format. \
|
||||
Please run `cargo metadata --format-version=1 | jq '.workspace_members'` and update this \
|
||||
build script to match the updated package ID format."
|
||||
);
|
||||
|
||||
let workspace_members = workspace_members
|
||||
.iter()
|
||||
.map(|package_id| {
|
||||
#[allow(clippy::expect_used)] // Safety: panicking in build scripts is okay for us
|
||||
package_id
|
||||
.repr
|
||||
.split_once(' ')
|
||||
.expect("Unknown cargo metadata package ID format")
|
||||
.0
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join(",");
|
||||
println!("cargo:rustc-env=CARGO_WORKSPACE_MEMBERS={workspace_members}");
|
||||
cargo_workspace::verify_cargo_metadata_format();
|
||||
cargo_workspace::set_cargo_workspace_members_env();
|
||||
}
|
||||
|
||||
82
crates/router_env/src/cargo_workspace.rs
Normal file
82
crates/router_env/src/cargo_workspace.rs
Normal file
@ -0,0 +1,82 @@
|
||||
/// Sets the `CARGO_WORKSPACE_MEMBERS` environment variable to include a comma-separated list of
|
||||
/// names of all crates in the current cargo workspace.
|
||||
///
|
||||
/// This function should be typically called within build scripts, so that the environment variable
|
||||
/// is available to the corresponding crate at compile time.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if running the `cargo metadata` command fails.
|
||||
#[allow(clippy::expect_used)]
|
||||
pub fn set_cargo_workspace_members_env() {
|
||||
use std::io::Write;
|
||||
|
||||
let metadata = cargo_metadata::MetadataCommand::new()
|
||||
.exec()
|
||||
.expect("Failed to obtain cargo metadata");
|
||||
let workspace_members = metadata.workspace_members;
|
||||
|
||||
let workspace_members = workspace_members
|
||||
.iter()
|
||||
.map(|package_id| {
|
||||
package_id
|
||||
.repr
|
||||
.split_once(' ')
|
||||
.expect("Unknown cargo metadata package ID format")
|
||||
.0
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join(",");
|
||||
|
||||
writeln!(
|
||||
&mut std::io::stdout(),
|
||||
"cargo:rustc-env=CARGO_WORKSPACE_MEMBERS={workspace_members}"
|
||||
)
|
||||
.expect("Failed to set `CARGO_WORKSPACE_MEMBERS` environment variable");
|
||||
}
|
||||
|
||||
/// Verify that the cargo metadata workspace members format matches that expected by
|
||||
/// [`set_cargo_workspace_members_env`] to set the `CARGO_WORKSPACE_MEMBERS` environment variable.
|
||||
///
|
||||
/// This function should be typically called within build scripts, before the
|
||||
/// [`set_cargo_workspace_members_env`] function is called.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if running the `cargo metadata` command fails, or if the workspace members package ID
|
||||
/// format cannot be determined.
|
||||
pub fn verify_cargo_metadata_format() {
|
||||
#[allow(clippy::expect_used)]
|
||||
let metadata = cargo_metadata::MetadataCommand::new()
|
||||
.exec()
|
||||
.expect("Failed to obtain cargo metadata");
|
||||
let workspace_members = metadata.workspace_members;
|
||||
|
||||
let package_id_entry_prefix =
|
||||
format!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
|
||||
assert!(
|
||||
workspace_members
|
||||
.iter()
|
||||
.any(|package_id| package_id.repr.starts_with(&package_id_entry_prefix)),
|
||||
"Unknown workspace members package ID format. \
|
||||
Please run `cargo metadata --format-version=1 | jq '.workspace_members'` and update this \
|
||||
build script to match the updated package ID format."
|
||||
);
|
||||
}
|
||||
|
||||
/// Obtain the crates in the current cargo workspace as a `HashSet`.
|
||||
///
|
||||
/// This macro requires that [`set_cargo_workspace_members_env()`] function be called in the
|
||||
/// build script of the crate where this macro is being called.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Causes a compilation error if the `CARGO_WORKSPACE_MEMBERS` environment variable is unset.
|
||||
#[macro_export]
|
||||
macro_rules! cargo_workspace_members {
|
||||
() => {
|
||||
std::env!("CARGO_WORKSPACE_MEMBERS")
|
||||
.split(',')
|
||||
.collect::<std::collections::HashSet<&'static str>>()
|
||||
};
|
||||
}
|
||||
@ -7,6 +7,8 @@
|
||||
|
||||
#![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR" ), "/", "README.md"))]
|
||||
|
||||
/// Utilities to identify members of the current cargo workspace.
|
||||
pub mod cargo_workspace;
|
||||
pub mod env;
|
||||
pub mod logger;
|
||||
pub mod metrics;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
//! Setup logging subsystem.
|
||||
|
||||
use std::{collections::HashSet, time::Duration};
|
||||
use std::time::Duration;
|
||||
|
||||
use opentelemetry::{
|
||||
global, runtime,
|
||||
@ -66,6 +66,7 @@ pub fn setup(
|
||||
config.file.level,
|
||||
&crates_to_filter,
|
||||
);
|
||||
println!("Using file logging filter: {file_filter}");
|
||||
|
||||
Some(FormattingLayer::new(service_name, file_writer).with_filter(file_filter))
|
||||
} else {
|
||||
@ -88,6 +89,7 @@ pub fn setup(
|
||||
config.console.level,
|
||||
&crates_to_filter,
|
||||
);
|
||||
println!("Using console logging filter: {console_filter}");
|
||||
|
||||
match config.console.log_format {
|
||||
config::LogFormat::Default => {
|
||||
@ -227,9 +229,7 @@ fn get_envfilter(
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
// Construct a default target filter otherwise
|
||||
let mut workspace_members = std::env!("CARGO_WORKSPACE_MEMBERS")
|
||||
.split(',')
|
||||
.collect::<HashSet<_>>();
|
||||
let mut workspace_members = crate::cargo_workspace_members!();
|
||||
workspace_members.extend(crates_to_filter.as_ref());
|
||||
|
||||
workspace_members
|
||||
|
||||
Reference in New Issue
Block a user