Crate android_logger
source ·Expand description
A logger which writes to android output.
Example
#[macro_use] extern crate log;
extern crate android_logger;
use log::Level;
use android_logger::Filter;
/// Android code may not have obvious "main", this is just an example.
fn main() {
android_logger::init_once(
Filter::default().with_min_level(Level::Trace),
None
);
debug!("this is a debug {}", "message");
error!("this is printed by default");
}
Example with module path filter
It is possible to limit log messages to output from a specific crate, and override the logcat tag name (by default, the crate name is used):
#[macro_use] extern crate log;
extern crate android_logger;
use log::Level;
use android_logger::Filter;
fn main() {
android_logger::init_once(
Filter::default()
.with_min_level(Level::Trace)
.with_allowed_module_path("hello::crate"),
Some("mytag")
);
// ..
}
Structs
Underlying android logger backend
Filter for android logger.