Skip to main content

EspIdfLogFilter

Struct EspIdfLogFilter 

Source
pub struct EspIdfLogFilter { /* private fields */ }
Expand description

Log filter backend based on the ESP-IDF logging configuration.

This filter is useful when the user would like to control the verbosity of the logging system based on the ESP-IDF configuration settings, which should apply both to the ESP-IDF native C logging, as well as to logging from Rust.

This backend uses the ESP-IDF logging system to filter log messages based on their target and level. Specifically:

  • The log crate is set to max level equal to the CONFIG_LOG_MAXIMUM_LEVEL ESP-IDF configuration.
  • The set_target_level method allows setting the log level for specific log targets (both targets based on Rust logging - i.e. most often than not Rust modules, as well as native ESP-IDF targets).

Implementations§

Source§

impl EspIdfLogFilter

Source

pub const fn new() -> Self

Create a new instance of EspIdfLogFilter.

Source

pub fn initialize(&self)

Initialize the ESP-IDF log filter backend.

Source

pub fn get_max_level(&self) -> LevelFilter

Return the maximum log level configured in the ESP-IDF.

Source

pub fn set_target_level( &self, target: impl AsRef<str>, level_filter: LevelFilter, ) -> Result<(), EspError>

Set the log level for a specific target.

Arguments:

  • target: The target for which to set the log level. This can be a Rust log target, or an ESP-IDF native target.
  • level_filter: The log level to set for the target.
Source

pub fn enabled(&self, metadata: &Metadata<'_>) -> bool

Check if logging for the given metadata is enabled, based on the ESP-IDF current log level, including taeget-specific log levels.

Trait Implementations§

Source§

impl Default for EspIdfLogFilter

Source§

fn default() -> Self

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

impl LogFilterBackend for EspIdfLogFilter

Source§

fn initialize(&self)

Initialize the log filter backend.
Source§

fn enabled(&self, metadata: &Metadata<'_>) -> bool

Check if logging for the given metadata is enabled.

Auto Trait Implementations§

§

impl !Freeze for EspIdfLogFilter

§

impl !RefUnwindSafe for EspIdfLogFilter

§

impl Send for EspIdfLogFilter

§

impl Sync for EspIdfLogFilter

§

impl Unpin for EspIdfLogFilter

§

impl UnsafeUnpin for EspIdfLogFilter

§

impl UnwindSafe for EspIdfLogFilter

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.