Skip to content

Commit

Permalink
Using EnvFilter instead hardcoded with_max_level. (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenpingfeng authored Oct 4, 2022
1 parent e8c3eb2 commit 246ec8f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
37 changes: 37 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pin-project-lite = "0.2"
rustls = {version = "0.20", default-features = false}
sha1 = "0.10"
tracing = "0.1"
tracing-subscriber = "0.3"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
webpki-roots = "0.22"

[profile.release]
Expand Down
8 changes: 6 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ use std::{rc::Rc, sync::Arc};

use clap::{Parser, Subcommand};
use monoio::net::TcpListener;
use tracing::{error, info, Level};
use tracing::{error, info};
use tracing_subscriber::{fmt, prelude::*, EnvFilter};

use crate::{client::ShadowTlsClient, server::ShadowTlsServer, util::set_tcp_keepalive};

Expand Down Expand Up @@ -68,7 +69,10 @@ enum Commands {
}

fn main() {
tracing_subscriber::fmt().with_max_level(Level::INFO).init();
tracing_subscriber::registry()
.with(fmt::layer())
.with(EnvFilter::from_default_env())
.init();
let args = Arc::new(Args::parse());
let mut threads = Vec::new();
let parallelism = get_parallelism(&args);
Expand Down

0 comments on commit 246ec8f

Please sign in to comment.