Config

Struct Config 

pub struct Config {
    default_level: SerdeLevelFilter,
    strict: bool,
    targets: HashMap<String, SerdeLevelFilter>,
    stdout: Config,
    dlt: Option<Config>,
    file: Option<Config>,
}
Expand description

Logging configuration.

§Example Serialization

default_level = "info" # Optional. Default is "off". One of "off", "error", "warn", "info", "debug", "trace".
strict = false         # Optional. Default is false. Whether to be strict about configuration errors.
targets = { "my_crate" = "debug" } # Optional. Default is empty.

[dlt] # Optional. Only available with the "dlt" feature.
# See `dlt::Config`.

[file] # Optional. Only available with the "file" feature.
# See `file::Config`.

Fields§

§default_level: SerdeLevelFilter§strict: bool§targets: HashMap<String, SerdeLevelFilter>§stdout: Config
Available on crate feature stdout only.
§dlt: Option<Config>
Available on crate feature dlt only.
§file: Option<Config>
Available on crate feature file only.

Implementations§

§

impl Config

pub const fn default_level(&self) -> LevelFilter

Returns the default level filter.

pub fn strict(&self) -> bool

Returns whether we’re in strict mode.

In non-strict mode, some configuration errors may be ignored.

pub fn targets(&self) -> impl Iterator<Item = (&str, LevelFilter)> + '_

Returns the target-specific level filters.

pub fn stdout(&self) -> &Config

Available on crate feature stdout only.

Returns the stdout configuration.

pub fn dlt(&self) -> Option<&Config>

Available on crate feature dlt only.

Returns the DLT configuration.

pub fn file(&self) -> Option<&Config>

Available on crate feature file only.

Returns the file configuration.

Trait Implementations§

§

impl Debug for Config

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Default for Config

§

fn default() -> Config

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

impl<'de> Deserialize<'de> for Config

§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

§

impl Freeze for Config

§

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 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,