From fe77f9a760fdb056a64ce2d811110b1ca9460d5c Mon Sep 17 00:00:00 2001 From: "zhuxiujia@qq.com" Date: Sat, 9 Mar 2024 23:41:08 +0800 Subject: [PATCH] change log filter/ModuleFilter --- src/filter.rs | 6 +----- tests/filter_test.rs | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/filter.rs b/src/filter.rs index 0ae9c95..10d0662 100644 --- a/src/filter.rs +++ b/src/filter.rs @@ -12,7 +12,7 @@ pub trait Filter: Send + Sync { /// use fast_log::Config; /// use fast_log::filter::ModuleFilter; /// let filter = ModuleFilter::new(); -/// filter.add(module_path!()); +/// filter.modules.push(module_path!().to_string()); /// fast_log::init(Config::new().console().add_filter(filter)).unwrap(); /// } /// ``` @@ -24,10 +24,6 @@ impl ModuleFilter { pub fn new() -> Self { Self { modules: SyncVec::new() } } - - pub fn add(&self, module: &str) { - self.modules.push(module.to_string()); - } } impl Filter for ModuleFilter { diff --git a/tests/filter_test.rs b/tests/filter_test.rs index df1ce06..13a1ded 100644 --- a/tests/filter_test.rs +++ b/tests/filter_test.rs @@ -8,7 +8,7 @@ mod test { #[test] fn test_send_pack() { let m = ModuleFilter::new(); - m.add( module_path!()); + m.modules.push(module_path!().to_string()); pub struct A{} impl LogAppender for A{ fn do_logs(&self, _records: &[FastLogRecord]) {