Skip to main content

LoggingConfig

Struct LoggingConfig 

Source
pub struct LoggingConfig {
    pub max_level: LevelFilter,
    pub filters: &'static [Filter],
}
Expand description

Logging configuration

Use this to specify certain configurations of the logging system. By default, the max log level is the log level set at compile time. See the compile time filters section for more information. The frontend also enables logging for all targets. Set the filters collection to specify log targets of interest.

If the default configuration is good for you, use Default::default().

use imxrt_log::log::{Filter, LoggingConfig};

const I2C_LOGGING: Filter = ("i2c", None);
const SPI_LOGGING: Filter = ("spi", Some(log::LevelFilter::Warn));
const MOTOR_LOGGING: Filter = ("motor", Some(log::LevelFilter::Trace));

let config = LoggingConfig {
    max_level: log::LevelFilter::Debug,
    filters: &[
        I2C_LOGGING,
        SPI_LOGGING,
        MOTOR_LOGGING,
    ]
};

Fields§

§max_level: LevelFilter

The max log level for all logging

This is the static max level. You may override this to bypass the statically-assigned max level

§filters: &'static [Filter]

A list of filtered targets to log.

If set to an empty slice (default), the logger performs no filtering. Otherwise, the frontend filters the specified targets by the accompanying log level. See Filter for more information.

Implementations§

Source§

impl LoggingConfig

Source

pub const fn new() -> Self

Create a default logging config.

Unlike default(), this works in const contexts.

Trait Implementations§

Source§

impl Default for LoggingConfig

Source§

fn default() -> LoggingConfig

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

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.