Struct serif::Config

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

Builder style configuration for the serif tracing-subscriber implementation.

Implementations§

source§

impl Config

source

pub fn new() -> Self

Create a new Config with the default configuration.

source

pub fn with_output(self, output: Output) -> Self

Change the output destination to stdout or stderr. The default is stdout.

source

pub fn with_color(self, color: ColorMode) -> Self

Enable or disable ANSI coloring. The default is ColorMode::Auto.

source

pub fn with_default(self, default: impl Into<Directive>) -> Self

Set the default log directive. The default is the INFO level.

You can call this with tracing::Level and tracing_subscriber::filter::LevelFilter, since those types implement Into<Directive>.

source

pub fn with_verbosity(self, verbosity: i32) -> Self

Set the default log level using a numberic “verbosity” value.

Applications can use this to easily turn the count of command line flags (e.g. --verbose or --quiet) into a default log level. This method does the same thing as Config::with_default and it makes no sense to combine them.

The mapping of verbosity levels to log levels is:

  • -3 or less: off (no logs enabled)
  • -2: error
  • -1: warning
  • 0: info
  • 1: debug
  • 2 or greater: trace
source

pub fn with_timestamp(self, time_format: TimeFormat) -> Self

Set the timestamp format for this Config.

source

pub fn with_target(self, display_target: bool) -> Self

Set whether or not an event’s target is displayed.

source

pub fn with_scope(self, display_scope: bool) -> Self

Set whether or not an event’s span scope is displayed.

source

pub fn init(self)

Finalize this Config and register it as the global default tracing subscriber.

§Panics

Panics if the RUST_LOG environment variable is invalid (see make_env_filter) or if another global subscriber is already installed (see SubscriberBuilder::init).

source

pub fn make_env_filter(&self) -> EnvFilter

Create an EnvFilter from this Config.

§Panics

Panics if the RUST_LOG environment variable contains invalid unicode, or if it contains invalid EnvFilter directives.

Trait Implementations§

source§

impl Clone for Config

source§

fn clone(&self) -> Config

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Config

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Config

source§

fn default() -> Self

Returns the “default value” for a type. 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.

source§

impl<T> Instrument for T

source§

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

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

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.
source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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