shadowsocks_rust/logging/
mod.rs1use std::path::Path;
4
5use log::warn;
6
7use crate::config::LogConfig;
8
9mod log4rs;
10mod tracing;
11
12pub fn init_with_file<P>(path: P)
14where
15 P: AsRef<Path>,
16{
17 log4rs::init_with_file(path);
18
19 warn!(
20 "log4rs doesn't support the tracing (https://crates.io/crates/tracing) framework,
21 so it would be removed in the future. Consider configure logging with RUST_LOG environment variable.
22 Check more configuration detail in https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/index.html#filtering-events-with-environment-variables ."
23 );
24}
25
26pub fn init_with_config(bin_name: &str, config: &LogConfig) {
28 tracing::init_with_config(bin_name, config);
30}
31
32pub fn init_with_default(bin_name: &str) {
34 init_with_config(bin_name, &LogConfig::default());
35}