diff --git a/docs/guide/developer.md b/docs/guide/developer.md index c194bba..c73da18 100644 --- a/docs/guide/developer.md +++ b/docs/guide/developer.md @@ -29,6 +29,22 @@ cp conf/live777.toml live777.toml cp conf/liveman.toml liveman.toml ``` +## Log + +Use `RUST_LOG` environment variable for set custom log level + +For `live777`, default log set + +```bash +RUST_LOG=live777=,net4mqtt=,http_log=,webrtc=error", +``` + +You can use this for override default log set + +```bash +RUST_LOG=live777=error,net4mqtt=debug,webrtc=error", +``` + ## Run in debug mode ### WebUI diff --git a/docs/zh/guide/developer.md b/docs/zh/guide/developer.md index c3cf837..a828479 100644 --- a/docs/zh/guide/developer.md +++ b/docs/zh/guide/developer.md @@ -29,6 +29,22 @@ cp conf/live777.toml live777.toml cp conf/liveman.toml liveman.toml ``` +## Log + +可以使用 `RUST_LOG` 环境变量来设置日志分模块输出 + +比如 `live777`, 目前模块日志输出为: + +```bash +RUST_LOG=live777=,net4mqtt=,http_log=,webrtc=error", +``` + +我们可以用这个变量覆盖默认的日志输出方案 + +```bash +RUST_LOG=live777=error,net4mqtt=debug,webrtc=error", +``` + ## 以开发模式运行 ### WebUI diff --git a/src/liveman.rs b/src/liveman.rs index 99b10b0..30ecd10 100644 --- a/src/liveman.rs +++ b/src/liveman.rs @@ -20,7 +20,7 @@ async fn main() { #[cfg(debug_assertions)] log::set(format!( - "liveman={},liveion={},http_log={},webrtc=error", + "liveman={},net4mqtt={},http_log={},webrtc=error", cfg.log.level, cfg.log.level, cfg.log.level )); diff --git a/src/main.rs b/src/main.rs index 978891d..1f8a75a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,8 +19,8 @@ async fn main() { let cfg: liveion::config::Config = utils::load("live777".to_string(), args.config); cfg.validate().unwrap(); log::set(format!( - "live777={},liveion={},http_log={},webrtc=error", - cfg.log.level, cfg.log.level, cfg.log.level + "live777={},liveion={},net4mqtt={},http_log={},webrtc=error", + cfg.log.level, cfg.log.level, cfg.log.level, cfg.log.level )); warn!("set log level : {}", cfg.log.level); debug!("config : {:?}", cfg);