09b68a8204
* Revert "NS API with directory v2 (#5068)"
This reverts commit cf4fe5f875.
* Merge pull request #5050 from nymtech/dz-node-status-api
Node Status API
* Ns agent workflow (#5055)
* feat: add dockerfile
* add github workflow for node status agent
---------
Co-authored-by: Fran Arbanas <arbanasfran@gmail.com>
* NS API with directory v2 (#5058)
* Use unstable explorer client
* Clean up stale testruns & logging
- log gw identity key
- better agent testrun logging
- log responses
- change response code for agents
* Better logging on agent
* Testrun stores gw identity key instead of gw pk
* Agent 0.1.3
* Agent 0.1.4
* Sqlx offline query data + clippy
* Compatible with directory v2
* Point to internal deps + rebase + v0.1.5
* self described field not null
* Fix build.rs typo
* Fix clippy
---------
Co-authored-by: Fran Arbanas <arbanasfran@gmail.com>
70 lines
2.1 KiB
Rust
70 lines
2.1 KiB
Rust
use tracing::level_filters::LevelFilter;
|
|
use tracing_subscriber::{filter::Directive, EnvFilter};
|
|
|
|
// TODO dz you can get the tracing-subscriber via basic-tracing feature on nym-bin-common
|
|
pub(crate) fn setup_tracing_logger() -> anyhow::Result<()> {
|
|
fn directive_checked(directive: impl Into<String>) -> anyhow::Result<Directive> {
|
|
directive.into().parse().map_err(From::from)
|
|
}
|
|
|
|
let log_builder = tracing_subscriber::fmt()
|
|
// Use a more compact, abbreviated log format
|
|
.compact()
|
|
// Display source code file paths
|
|
.with_file(true)
|
|
// Display source code line numbers
|
|
.with_line_number(true)
|
|
.with_thread_ids(true)
|
|
// Don't display the event's target (module path)
|
|
.with_target(false);
|
|
|
|
let mut filter = EnvFilter::builder()
|
|
// if RUST_LOG isn't set, set default level
|
|
.with_default_directive(LevelFilter::DEBUG.into())
|
|
.from_env_lossy();
|
|
|
|
// these crates are more granularly filtered
|
|
let warn_crates = [
|
|
"reqwest",
|
|
"rustls",
|
|
"hyper",
|
|
"sqlx",
|
|
"h2",
|
|
"tendermint_rpc",
|
|
"tower_http",
|
|
"axum",
|
|
];
|
|
for crate_name in warn_crates {
|
|
filter = filter.add_directive(directive_checked(format!("{}=warn", crate_name))?);
|
|
}
|
|
|
|
let log_level_hint = filter.max_level_hint();
|
|
|
|
// debug or higher granularity (e.g. trace)
|
|
let debug_or_higher = std::cmp::max(
|
|
log_level_hint.unwrap_or(LevelFilter::DEBUG),
|
|
LevelFilter::DEBUG,
|
|
);
|
|
filter = filter.add_directive(directive_checked(format!(
|
|
"nym_bin_common={}",
|
|
debug_or_higher
|
|
))?);
|
|
filter = filter.add_directive(directive_checked(format!(
|
|
"nym_explorer_client={}",
|
|
debug_or_higher
|
|
))?);
|
|
filter = filter.add_directive(directive_checked(format!(
|
|
"nym_network_defaults={}",
|
|
debug_or_higher
|
|
))?);
|
|
filter = filter.add_directive(directive_checked(format!(
|
|
"nym_validator_client={}",
|
|
debug_or_higher
|
|
))?);
|
|
|
|
log_builder.with_env_filter(filter).init();
|
|
tracing::info!("Log level: {:?}", log_level_hint);
|
|
|
|
Ok(())
|
|
}
|