Struct Format

Source
pub struct Format<F = Full, T = SystemTime> { /* private fields */ }
Expand description

A pre-configured event formatter.

You will usually want to use this as the FormatEvent for a FmtSubscriber.

The default logging format, Full includes all fields in each event and its containing spans. The Compact logging format includes only the fields from the most-recently-entered span.

Implementations§

Source§

impl<F, T> Format<F, T>

Source

pub fn compact(self) -> Format<Compact, T>

Use a less verbose output format.

See Compact.

Source

pub fn with_timer<T2>(self, timer: T2) -> Format<F, T2>

Use the given timer for log message timestamps.

See time for the provided timer implementations.

Note that using the chrono feature flag enables the additional time formatters ChronoUtc and ChronoLocal.

Source

pub fn without_time(self) -> Format<F, ()>

Do not emit timestamps with log messages.

Source

pub fn with_ansi(self, ansi: bool) -> Format<F, T>

Enable ANSI terminal colors for formatted output.

Source

pub fn with_target(self, display_target: bool) -> Format<F, T>

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

Trait Implementations§

Source§

impl<F, T> Clone for Format<F, T>
where F: Clone, T: Clone,

Source§

fn clone(&self) -> Format<F, T>

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<F, T> Debug for Format<F, T>
where F: Debug, T: Debug,

Source§

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

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

impl Default for Format

Source§

fn default() -> Format

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

impl<N, T> FormatEvent<N> for Format<Compact, T>
where N: for<'a> NewVisitor<'a>, T: FormatTime,

Source§

fn format_event( &self, ctx: &Context<'_, N>, writer: &mut dyn Write, event: &Event<'_>, ) -> Result<(), Error>

Write a log message for Event in Context to the given Write.
Source§

impl<N, T> FormatEvent<N> for Format<Full, T>
where N: for<'a> NewVisitor<'a>, T: FormatTime,

Source§

fn format_event( &self, ctx: &Context<'_, N>, writer: &mut dyn Write, event: &Event<'_>, ) -> Result<(), Error>

Write a log message for Event in Context to the given Write.

Auto Trait Implementations§

§

impl<F, T> Freeze for Format<F, T>
where T: Freeze,

§

impl<F, T> RefUnwindSafe for Format<F, T>

§

impl<F, T> Send for Format<F, T>
where T: Send, F: Send,

§

impl<F, T> Sync for Format<F, T>
where T: Sync, F: Sync,

§

impl<F, T> Unpin for Format<F, T>
where T: Unpin, F: Unpin,

§

impl<F, T> UnwindSafe for Format<F, T>
where T: UnwindSafe, F: UnwindSafe,

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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

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

impl<T> Erased for T