clap-log-flag

crates.io version build status downloads docs.rs docs

Add a logger to CLIs using structopt.

Usage

```rust extern crate claplogflag;

[macro_use]

extern crate log; extern crate clapverbosityflag;

[macro_use]

extern crate structopt;

use structopt::StructOpt;

[derive(Debug, StructOpt)]

struct Cli { #[structopt(flatten)] verbose: clapverbosityflag::Verbosity, #[structopt(flatten)] log: claplogflag::Log, }

fn main() -> Result<(), Box> { let args = Cli::fromargs(); args.log.logall(args.verbose.log_level())?; info!("hello"); error!("oh no!"); Ok(()) } ```

Installation

sh $ cargo add clap-log-flag

License

MIT OR Apache-2.0