Struct android_logger::Config

source ·
pub struct Config { /* private fields */ }
Expand description

Filter for android logger.

Implementations§

source§

impl Config

source

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.

source

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.

source

pub fn with_filter(self, filter: Filter) -> Self

source

pub fn with_tag<S: Into<Vec<u8>>>(self, tag: S) -> Self

source

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()))
)

Trait Implementations§

source§

impl Default for Config

source§

fn default() -> Config

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.