fix(hermes): improve tracing logs
- Add EnvFilter to respect RUST_LOG - Disable ANSI if stderr is not a terminal
This commit is contained in:
parent
860178f057
commit
ed505d9e53
|
@ -731,7 +731,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-automata 0.3.3",
|
||||
"serde",
|
||||
]
|
||||
|
||||
|
@ -1764,7 +1764,7 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
|||
|
||||
[[package]]
|
||||
name = "hermes"
|
||||
version = "0.1.14"
|
||||
version = "0.1.15"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"axum",
|
||||
|
@ -2932,6 +2932,15 @@ version = "0.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4"
|
||||
|
||||
[[package]]
|
||||
name = "matchers"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
|
||||
dependencies = [
|
||||
"regex-automata 0.1.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.10"
|
||||
|
@ -4187,8 +4196,17 @@ checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575"
|
|||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
"regex-automata 0.3.3",
|
||||
"regex-syntax 0.7.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
||||
dependencies = [
|
||||
"regex-syntax 0.6.29",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4199,9 +4217,15 @@ checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310"
|
|||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
"regex-syntax 0.7.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.7.4"
|
||||
|
@ -6085,10 +6109,14 @@ version = "0.3.17"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77"
|
||||
dependencies = [
|
||||
"matchers",
|
||||
"nu-ansi-term",
|
||||
"once_cell",
|
||||
"regex",
|
||||
"sharded-slab",
|
||||
"smallvec",
|
||||
"thread_local",
|
||||
"tracing",
|
||||
"tracing-core",
|
||||
"tracing-log",
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "hermes"
|
||||
version = "0.1.14"
|
||||
version = "0.1.15"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
@ -37,7 +37,7 @@ strum = { version = "0.24.1", features = ["derive"] }
|
|||
tokio = { version = "1.26.0", features = ["full"] }
|
||||
tower-http = { version = "0.4.0", features = ["cors"] }
|
||||
tracing = { version = "0.1.37", features = ["log"] }
|
||||
tracing-subscriber = { version = "0.3.17" }
|
||||
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
||||
utoipa = { version = "3.4.0", features = ["axum_extras"] }
|
||||
utoipa-swagger-ui = { version = "3.1.4", features = ["axum"] }
|
||||
wormhole-sdk = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.17.1" }
|
||||
|
|
|
@ -9,8 +9,10 @@ with pkgs; mkShell {
|
|||
nettle
|
||||
openssl_1_1
|
||||
pkgconfig
|
||||
iconv
|
||||
protobuf
|
||||
go
|
||||
rustup
|
||||
systemd
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
|
|
|
@ -6,7 +6,10 @@ use {
|
|||
crate::store::Store,
|
||||
anyhow::Result,
|
||||
futures::future::join_all,
|
||||
std::sync::atomic::AtomicBool,
|
||||
std::{
|
||||
io::IsTerminal,
|
||||
sync::atomic::AtomicBool,
|
||||
},
|
||||
structopt::StructOpt,
|
||||
tokio::spawn,
|
||||
};
|
||||
|
@ -74,8 +77,6 @@ async fn init() -> Result<()> {
|
|||
#[tokio::main]
|
||||
#[tracing::instrument]
|
||||
async fn main() -> Result<()> {
|
||||
env_logger::init();
|
||||
|
||||
// Initialize a Tracing Subscriber
|
||||
tracing::subscriber::set_global_default(
|
||||
tracing_subscriber::fmt()
|
||||
|
@ -83,6 +84,8 @@ async fn main() -> Result<()> {
|
|||
.with_file(false)
|
||||
.with_line_number(true)
|
||||
.with_thread_ids(true)
|
||||
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
||||
.with_ansi(std::io::stderr().is_terminal())
|
||||
.finish(),
|
||||
)?;
|
||||
|
||||
|
|
Loading…
Reference in New Issue