[][src]Struct slog_logfmt::LogfmtBuilder

pub struct LogfmtBuilder<W: Write> { /* fields omitted */ }

A constructor for a Logfmt drain.

Methods

impl<W: Write> LogfmtBuilder<W>[src]

pub fn build(self) -> Logfmt<W>[src]

Constructs the drain.

pub fn set_prefix(
    self,
    prefix: fn(_: &mut dyn Write, _: &Record) -> Result
) -> Self
[src]

Set a function that prints a (not necessarily logfmt-formatted) prefix to the output stream.

pub fn no_prefix(self) -> Self[src]

Sets the logger up to print no prefix, effectively starting the line entirely logfmt field-formatted.

pub fn redact(self, redact: fn(_: &Key) -> Redaction) -> Self[src]

Sets a function that makes decisions on whether to log a field.

This function must return a Redaction result, which has two variants at the moment: Redact::Skip to not log the field, and Redact::Plain to log the field value in plain text.

pub fn print_msg(self, print: bool) -> Self[src]

Choose whether to print the log message.

The default prefix already prints it, so the default is to skip.

pub fn print_level(self, print: bool) -> Self[src]

Choose whether to print the log level.

The default prefix already prints it, so the default is to skip.

pub fn print_tag(self, print: bool) -> Self[src]

Choose whether to print the log level.

The default prefix already prints it, so the default is to skip.

pub fn force_quotes(self) -> Self[src]

Force quoting field values even if they don't contain quotable characters.

Setting this option will surround values with quotes like foo="bar".

Auto Trait Implementations

impl<W> RefUnwindSafe for LogfmtBuilder<W> where
    W: RefUnwindSafe

impl<W> Send for LogfmtBuilder<W> where
    W: Send

impl<W> Sync for LogfmtBuilder<W> where
    W: Sync

impl<W> Unpin for LogfmtBuilder<W> where
    W: Unpin

impl<W> UnwindSafe for LogfmtBuilder<W> where
    W: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.