Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Jan 28, 2022. It is now read-only.
/clap-log-flagPublic archive

Add a logger to CLIs using structopt

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

clap-rs/clap-log-flag

crates.io versionbuild statusdownloadsdocs.rs docs

Add a logger to CLIs using structopt.

Usage

externcrate clap_log_flag;#[macro_use]externcrate log;externcrate clap_verbosity_flag;#[macro_use]externcrate structopt;use structopt::StructOpt;#[derive(Debug,StructOpt)]structCli{#[structopt(flatten)]verbose: clap_verbosity_flag::Verbosity,#[structopt(flatten)]log: clap_log_flag::Log,}fnmain() ->Result<(),Box<dyn std::error::Error>>{let args =Cli::from_args();  args.log.log_all(args.verbose.log_level())?;info!("hello");error!("oh no!");Ok(())}

Output

clap-log-flag 0.1.0Yoshua Wuyts <yoshuawuyts@gmail.com>Add a logger to CLIs using structoptUSAGE:    main [FLAGS]FLAGS:    -h, --help         Prints help information    -P, --pretty       Enable pretty printing.    -V, --version      Prints version information    -v, --verbosity    Pass many times for more log output

Installation

$ cargo add clap-log-flag

License

MIT ORApache-2.0

About

Add a logger to CLIs using structopt

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp