mirror of
https://github.com/aljazceru/cdk.git
synced 2026-01-10 00:16:02 +01:00
* feat: add LDK Node Lightning backend with comprehensive integration - Add new cdk-ldk-node crate implementing Lightning backend using LDK Node - Extend MintPayment trait with start/stop methods for processor lifecycle management - Add LDK Node configuration support to cdk-mintd with chain source and gossip options - Enhance mint startup/shutdown to properly manage payment processor lifecycle --------- Co-authored-by: Erik <78821053+swedishfrenchpress@users.noreply.github.com>
43 lines
1.4 KiB
Rust
43 lines
1.4 KiB
Rust
//! Common CLI and logging utilities for CDK integration test binaries
|
|
//!
|
|
//! This module provides standardized CLI argument parsing and logging setup
|
|
//! for integration test binaries.
|
|
|
|
use clap::Parser;
|
|
use tracing_subscriber::EnvFilter;
|
|
|
|
/// Common CLI arguments for CDK integration test binaries
|
|
#[derive(Parser, Debug)]
|
|
pub struct CommonArgs {
|
|
/// Enable logging (default is false)
|
|
#[arg(long, default_value_t = false)]
|
|
pub enable_logging: bool,
|
|
|
|
/// Logging level when enabled (default is debug)
|
|
#[arg(long, default_value = "debug")]
|
|
pub log_level: tracing::Level,
|
|
}
|
|
|
|
/// Initialize logging based on CLI arguments
|
|
pub fn init_logging(enable_logging: bool, log_level: tracing::Level) {
|
|
if enable_logging {
|
|
let default_filter = log_level.to_string();
|
|
|
|
// Common filters to reduce noise
|
|
let hyper_filter = "hyper=warn";
|
|
let h2_filter = "h2=warn";
|
|
let rustls_filter = "rustls=warn";
|
|
let reqwest_filter = "reqwest=warn";
|
|
let tower_filter = "tower_http=warn";
|
|
|
|
let env_filter = EnvFilter::new(format!(
|
|
"{default_filter},{hyper_filter},{h2_filter},{rustls_filter},{reqwest_filter},{tower_filter}"
|
|
));
|
|
|
|
// Ok if successful, Err if already initialized
|
|
let _ = tracing_subscriber::fmt()
|
|
.with_env_filter(env_filter)
|
|
.try_init();
|
|
}
|
|
}
|