Struct android_logd_logger::Builder [−][src]
Builder for initializing logger
The builder is used to initialize the logging framework for later use. It provides
Implementations
impl<'a> Builder<'a>
[src]
pub fn new() -> Builder<'a>
[src]
Initializes the log builder with defaults.
Examples
Create a new builder and configure filters and style:
let mut builder = Builder::new(); builder.filter(None, LevelFilter::Info) .init();
pub fn buffer(&mut self, buffer: Buffer) -> &mut Self
[src]
Use a specific android log buffer. Defaults to the main buffer is used as tag (if present)
Examples
let mut builder = Builder::new(); builder.buffer(Buffer::Crash) .init();
pub fn tag(&mut self, tag: &'a str) -> &mut Self
[src]
Use a specific log tag. If no tag is set the module path is used as tag (if present)
Examples
let mut builder = Builder::new(); builder.tag("foo") .init();
pub fn prepend_module(&mut self, prepend: bool) -> &mut Self
[src]
Prepend module to log message. If set true the Rust module path is prepended to the log message.
Examples
let mut builder = Builder::new(); builder.prepend_module(true) .init();
pub fn filter_module(&mut self, module: &str, level: LevelFilter) -> &mut Self
[src]
Adds a directive to the filter for a specific module.
Examples
Only include messages for warning and above for logs in path::to::module
:
let mut builder = Builder::new(); builder.filter_module("path::to::module", LevelFilter::Info);
pub fn filter_level(&mut self, level: LevelFilter) -> &mut Self
[src]
Adds a directive to the filter for all modules.
Examples
Only include messages for warning and above for logs in path::to::module
:
let mut builder = Builder::new(); builder.filter_level(LevelFilter::Info);
pub fn filter(&mut self, module: Option<&str>, level: LevelFilter) -> &mut Self
[src]
Adds filters to the logger.
The given module (if any) will log at most the specified level provided. If no module is provided then the filter will apply to all log messages.
Examples
Only include messages for warning and above for logs in path::to::module
:
let mut builder = Builder::new(); builder.filter(Some("path::to::module"), LevelFilter::Info);
pub fn parse_filters(&mut self, filters: &str) -> &mut Self
[src]
Parses the directives string in the same form as the RUST_LOG
environment variable.
See the module documentation for more details.
pub fn try_init(&mut self) -> Result<(), SetLoggerError>
[src]
Initializes the global logger with the built logd logger.
This should be called early in the execution of a Rust program. Any log events that occur before initialization will be ignored.
Errors
This function will fail if it is called more than once, or if another library has already initialized a global logger.
pub fn init(&mut self)
[src]
Initializes the global logger with the built logger.
This should be called early in the execution of a Rust program. Any log events that occur before initialization will be ignored.
Panics
This function will panic if it is called more than once, or if another library has already initialized a global logger.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Builder<'a>
impl<'a> Send for Builder<'a>
impl<'a> Sync for Builder<'a>
impl<'a> Unpin for Builder<'a>
impl<'a> UnwindSafe for Builder<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,