Struct android_logger::Filter [−][src]
pub struct Filter { /* fields omitted */ }
Filter for android logger.
Methods
impl Filter
[src]
impl Filter
pub fn with_min_level(self, level: Level) -> Self
[src]
pub fn with_min_level(self, level: Level) -> Self
Change the minimum log level.
All values above the set level are logged. For example, if
Warn
is set, the Error
is logged too, but Info
isn't.
pub fn with_allowed_module_path<S: Into<String>>(self, path: S) -> Self
[src]
pub fn with_allowed_module_path<S: Into<String>>(self, path: S) -> Self
Set allowed module path.
Allow log entry only if module path matches specified path exactly.
Example:
use android_logger::Filter; let filter = Filter::default().with_allowed_module_path("crate"); assert!(filter.is_module_path_allowed("crate")); assert!(!filter.is_module_path_allowed("other_crate")); assert!(!filter.is_module_path_allowed("crate::subcrate"));
Multiple rules example:
use android_logger::Filter; let filter = Filter::default() .with_allowed_module_path("A") .with_allowed_module_path("B"); assert!(filter.is_module_path_allowed("A")); assert!(filter.is_module_path_allowed("B")); assert!(!filter.is_module_path_allowed("C")); assert!(!filter.is_module_path_allowed("A::B"));
pub fn with_allowed_module_paths<I: IntoIterator<Item = String>>(
self,
paths: I
) -> Self
[src]
pub fn with_allowed_module_paths<I: IntoIterator<Item = String>>(
self,
paths: I
) -> Self
Set multiple allowed module paths.
Same as with_allowed_module_path
, but accepts list of paths.
Example:
use android_logger::Filter; let filter = Filter::default() .with_allowed_module_paths(["A", "B"].iter().map(|i| i.to_string())); assert!(filter.is_module_path_allowed("A")); assert!(filter.is_module_path_allowed("B")); assert!(!filter.is_module_path_allowed("C")); assert!(!filter.is_module_path_allowed("A::B"));
pub fn is_module_path_allowed(&self, path: &str) -> bool
[src]
pub fn is_module_path_allowed(&self, path: &str) -> bool
Check if module path is allowed by filter rules.