add proper command line options and logging

This commit is contained in:
2022-10-21 17:51:47 +08:00
parent e871ec2b29
commit 05e5344b92
6 changed files with 95 additions and 14 deletions

View File

@ -1,3 +1,5 @@
use std::str::FromStr;
use clap::Parser;
use libvanity::vanity::VanityRequest;
@ -11,12 +13,20 @@ struct Args {
#[clap(help = "pattern of public key")]
pattern: String,
#[clap(short, long, default_value = "WARN")]
log_level: String,
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let args = Args::parse();
let level = tracing::Level::from_str(&args.log_level)?;
tracing_subscriber::FmtSubscriber::builder()
.with_max_level(level)
.init();
let mut client =
libvanity::vanity::vanity_service_client::VanityServiceClient::connect(args.endpoint)
.await?;