Struct android_logger::Filter[][src]

pub struct Filter { /* fields omitted */ }

Filter for android logger.

Methods

impl Filter
[src]

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.

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"));

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"));

Check if module path is allowed by filter rules.

Trait Implementations

impl Default for Filter
[src]

Returns the "default value" for a type. Read more

Auto Trait Implementations

impl Send for Filter

impl Sync for Filter