Name Description Size
lib.rs A logger which writes to android output. ## Example ``` #[macro_use] extern crate log; extern crate android_logger; use log::LevelFilter; use android_logger::Config; /// Android code may not have obvious "main", this is just an example. fn main() { android_logger::init_once( Config::default().with_max_level(LevelFilter::Trace), ); 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::LevelFilter; use android_logger::{Config,FilterBuilder}; fn main() { android_logger::init_once( Config::default() .with_max_level(LevelFilter::Trace) .with_tag("mytag") .with_filter(FilterBuilder::new().parse("debug,hello::crate=trace").build()), ); // .. } ``` ## Example with a custom log formatter ``` use android_logger::Config; android_logger::init_once( Config::default() .with_max_level(log::LevelFilter::Trace) .format(|f, record| write!(f, "my_app: {}", record.args())) ) ``` 21025