Struct android_logger::Config
source · 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.
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
pub fn with_tag<S: Into<Vec<u8>>>(self, tag: S) -> Self
sourcepub fn format<F>(self, format: F) -> Selfwhere
F: Fn(&mut dyn Write, &Record<'_>) -> Result + Sync + Send + 'static,
pub fn format<F>(self, format: F) -> Selfwhere F: Fn(&mut dyn Write, &Record<'_>) -> Result + Sync + Send + 'static,
Sets the format function for formatting the log output.
android_logger::init_once(
Config::default()
.with_max_level(log::LevelFilter::Trace)
.format(|f, record| write!(f, "my_app: {}", record.args()))
)