Add cmd line options to control color output and nb of worker threads
This commit is contained in:
parent
debe4c7d85
commit
89c8405396
1 changed files with 17 additions and 1 deletions
18
src/main.rs
18
src/main.rs
|
@ -42,6 +42,22 @@ use url::{Host, Url};
|
||||||
struct Wstunnel {
|
struct Wstunnel {
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
commands: Commands,
|
commands: Commands,
|
||||||
|
|
||||||
|
/// Disable color output in logs
|
||||||
|
#[arg(long, global = true, verbatim_doc_comment, env = "NO_COLOR")]
|
||||||
|
no_color: Option<String>,
|
||||||
|
|
||||||
|
/// *WARNING* The flag does nothing, you need to set the env variable *WARNING*
|
||||||
|
/// Control the number of threads that will be used.
|
||||||
|
/// By default it is equal the number of cpus
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
global = true,
|
||||||
|
value_name = "INT",
|
||||||
|
verbatim_doc_comment,
|
||||||
|
env = "TOKIO_WORKER_THREADS"
|
||||||
|
)]
|
||||||
|
nb_worker_threads: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(clap::Subcommand, Debug)]
|
#[derive(clap::Subcommand, Debug)]
|
||||||
|
@ -546,7 +562,7 @@ async fn main() {
|
||||||
> 0 => {}
|
> 0 => {}
|
||||||
_ => {
|
_ => {
|
||||||
tracing_subscriber::fmt()
|
tracing_subscriber::fmt()
|
||||||
.with_ansi(true)
|
.with_ansi(args.no_color.is_none())
|
||||||
.with_env_filter(
|
.with_env_filter(
|
||||||
EnvFilter::builder()
|
EnvFilter::builder()
|
||||||
.with_default_directive(Level::INFO.into())
|
.with_default_directive(Level::INFO.into())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue