Skip to content

Commit

Permalink
adjust log output level
Browse files Browse the repository at this point in the history
  • Loading branch information
Marsyew authored Oct 9, 2023
1 parent 12e16b4 commit a234f40
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use path::manager::Manager;
use std::net::SocketAddr;
use std::str::FromStr;
use std::sync::Arc;
use std::env;

use tower_http::validate_request::ValidateRequestHeaderLayer;
use webrtc::peer_connection::sdp::session_description::RTCSessionDescription;
Expand All @@ -27,9 +28,19 @@ mod path;

#[tokio::main]
async fn main() {
let log_level = env::var("LOG_LEVEL").unwrap_or_else(|_| "info".to_string());
let level_filter = match log_level.as_str() {
"off" => log::LevelFilter::Off,
"error" => log::LevelFilter::Error,
"warn" => log::LevelFilter::Warn,
"info" => log::LevelFilter::Info,
"debug" => log::LevelFilter::Debug,
"trace" => log::LevelFilter::Trace,
_ => log::LevelFilter::Info,
};
env_logger::builder()
.filter_level(log::LevelFilter::Debug)
.filter_module("webrtc", log::LevelFilter::Trace)
.filter_level(level_filter)
.filter_module("webrtc", log::LevelFilter::Error)
.write_style(env_logger::WriteStyle::Auto)
.target(env_logger::Target::Stdout)
.init();
Expand Down

0 comments on commit a234f40

Please sign in to comment.