pub struct Config { /* private fields */ }Expand description
Filter for android logger.
Implementations§
Source§impl Config
impl Config
Sourcepub fn with_max_level(self, level: LevelFilter) -> Self
pub fn with_max_level(self, level: LevelFilter) -> Self
Changes the maximum log level.
Note, that Trace is the maximum level, because it provides the
maximum amount of detail in the emitted logs.
If Off level is provided, then nothing is logged at all.
log::max_level() is considered as the default level.
Examples found in repository?
examples/system_log_level_overrides.rs (line 76)
70fn main() {
71 android_logger::init_once(
72 android_logger::Config::default()
73 .with_tag("log_test")
74 // If set, this is the highest level to log unless overriddeby by the system.
75 // Note the verbosity can be *increased* through system properties.
76 .with_max_level(log::LevelFilter::Info),
77 );
78 // The log crate applies its filtering before we even get to android_logger.
79 // Pass everything down so that Android's liblog can determine the log level instead.
80 log::set_max_level(log::LevelFilter::Trace);
81
82 log::trace!("trace");
83 log::debug!("debug");
84 log::info!("info");
85 log::warn!("warn");
86 log::error!("error");
87}Sourcepub fn with_log_buffer(self, buf_id: LogId) -> Self
pub fn with_log_buffer(self, buf_id: LogId) -> Self
Changes the Android logging system buffer to be used.
By default, logs are sent to the Main log. Other logging buffers may
only be accessible to certain processes.
pub fn with_filter(self, filter: Filter) -> Self
Sourcepub fn with_tag<S: Into<Vec<u8>>>(self, tag: S) -> Self
pub fn with_tag<S: Into<Vec<u8>>>(self, tag: S) -> Self
Examples found in repository?
examples/system_log_level_overrides.rs (line 73)
70fn main() {
71 android_logger::init_once(
72 android_logger::Config::default()
73 .with_tag("log_test")
74 // If set, this is the highest level to log unless overriddeby by the system.
75 // Note the verbosity can be *increased* through system properties.
76 .with_max_level(log::LevelFilter::Info),
77 );
78 // The log crate applies its filtering before we even get to android_logger.
79 // Pass everything down so that Android's liblog can determine the log level instead.
80 log::set_max_level(log::LevelFilter::Trace);
81
82 log::trace!("trace");
83 log::debug!("debug");
84 log::info!("info");
85 log::warn!("warn");
86 log::error!("error");
87}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl !RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl !UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more