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
logcrate is set to max level equal to theCONFIG_LOG_MAXIMUM_LEVELESP-IDF configuration. - The
set_target_levelmethod 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
impl EspIdfLogFilter
Sourcepub fn initialize(&self)
pub fn initialize(&self)
Initialize the ESP-IDF log filter backend.
Sourcepub fn get_max_level(&self) -> LevelFilter
pub fn get_max_level(&self) -> LevelFilter
Return the maximum log level configured in the ESP-IDF.
Sourcepub fn set_target_level(
&self,
target: impl AsRef<str>,
level_filter: LevelFilter,
) -> Result<(), EspError>
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.