Skip to content

Commit

Permalink
Add quiet mode for now
Browse files Browse the repository at this point in the history
  • Loading branch information
itsrainy committed Jan 17, 2023
1 parent 2348da3 commit 2d6b1cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ fn install_tracing_subscriber(opts: &Opts) {
}
}
}
// If the quiet flag is passed in, don't log anything (this should maybe
// just be a verbosity setting)
if opts.quiet() {
env::set_var("RUST_LOG", "viceroy=off,viceroy-lib=off");
}
// Build a subscriber, using the default `RUST_LOG` environment variable for our filter.
let builder = FmtSubscriber::builder()
.with_writer(StdWriter::new())
Expand Down
6 changes: 6 additions & 0 deletions cli/src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ pub struct Opts {
// Whether to enable wasmtime's builtin profiler.
#[arg(long = "profiler", value_parser = check_wasmtime_profiler_mode)]
profiler: Option<ProfilingStrategy>,
#[arg(short = 'q', long = "quiet", default_value = "false")]
quiet: bool,
// Command line to start child process
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
run: Vec<String>,
Expand Down Expand Up @@ -99,6 +101,10 @@ impl Opts {
pub fn run(&self) -> &[String] {
self.run.as_ref()
}

pub fn quiet(&self) -> bool {
self.quiet
}
}

/// A parsing function used by [`Opts`][opts] to check that the input is a valid Wasm module in
Expand Down

0 comments on commit 2d6b1cf

Please sign in to comment.