Skip to content

Commit

Permalink
Merge pull request #121 from chris-stones/topic/add_filter_allow_doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Mar 17, 2023
2 parents 0d7e6ea + 6ec2061 commit ee2ab1b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/config.rs
Expand Up @@ -242,8 +242,8 @@ impl ConfigBuilder {
self
}

/// Add allowed module filters.
/// If any are specified, only records from modules starting with one of these entries will be printed
/// Add allowed target filters.
/// If any are specified, only records from targets matching one of these entries will be printed
///
/// For example, `add_filter_allow_str("tokio::uds")` would allow only logging from the `tokio` crates `uds` module.
pub fn add_filter_allow_str(&mut self, filter_allow: &'static str) -> &mut ConfigBuilder {
Expand All @@ -253,26 +253,26 @@ impl ConfigBuilder {
self
}

/// Add allowed module filters.
/// If any are specified, only records from modules starting with one of these entries will be printed
/// Add allowed target filters.
/// If any are specified, only records from targets matching one of these entries will be printed
///
/// For example, `add_filter_allow(format!("{}{}","tokio", "uds"))` would allow only logging from the `tokio` crates `uds` module.
/// For example, `add_filter_allow(format!("{}::{}","tokio", "uds"))` would allow only logging from the `tokio` crates `uds` module.
pub fn add_filter_allow(&mut self, filter_allow: String) -> &mut ConfigBuilder {
let mut list = Vec::from(&*self.0.filter_allow);
list.push(Cow::Owned(filter_allow));
self.0.filter_allow = Cow::Owned(list);
self
}

/// Clear allowed module filters.
/// Clear allowed target filters.
/// If none are specified, nothing is filtered out
pub fn clear_filter_allow(&mut self) -> &mut ConfigBuilder {
self.0.filter_allow = Cow::Borrowed(&[]);
self
}

/// Add denied module filters.
/// If any are specified, records from modules starting with one of these entries will be ignored
/// Add denied target filters.
/// If any are specified, records from targets matching one of these entries will be ignored
///
/// For example, `add_filter_ignore_str("tokio::uds")` would deny logging from the `tokio` crates `uds` module.
pub fn add_filter_ignore_str(&mut self, filter_ignore: &'static str) -> &mut ConfigBuilder {
Expand All @@ -282,18 +282,18 @@ impl ConfigBuilder {
self
}

/// Add denied module filters.
/// If any are specified, records from modules starting with one of these entries will be ignored
/// Add denied target filters.
/// If any are specified, records from targets matching one of these entries will be ignored
///
/// For example, `add_filter_ignore(format!("{}{}","tokio", "uds"))` would deny logging from the `tokio` crates `uds` module.
/// For example, `add_filter_ignore(format!("{}::{}","tokio", "uds"))` would deny logging from the `tokio` crates `uds` module.
pub fn add_filter_ignore(&mut self, filter_ignore: String) -> &mut ConfigBuilder {
let mut list = Vec::from(&*self.0.filter_ignore);
list.push(Cow::Owned(filter_ignore));
self.0.filter_ignore = Cow::Owned(list);
self
}

/// Clear ignore module filters.
/// Clear ignore target filters.
/// If none are specified, nothing is filtered
pub fn clear_filter_ignore(&mut self) -> &mut ConfigBuilder {
self.0.filter_ignore = Cow::Borrowed(&[]);
Expand Down

0 comments on commit ee2ab1b

Please sign in to comment.