pub struct LogfmtBuilder<W: Write> { /* private fields */ }
Expand description
A constructor for a Logfmt
drain.
Implementations§
Source§impl<W: Write> LogfmtBuilder<W>
impl<W: Write> LogfmtBuilder<W>
Sourcepub fn set_prefix(
self,
prefix: fn(&mut dyn Write, &Record<'_>) -> Result,
) -> Self
pub fn set_prefix( self, prefix: fn(&mut dyn Write, &Record<'_>) -> Result, ) -> Self
Set a function that prints a (not necessarily logfmt-formatted) prefix to the output stream.
Sourcepub fn no_prefix(self) -> Self
pub fn no_prefix(self) -> Self
Sets the logger up to print no prefix, effectively starting the line entirely logfmt field-formatted.
Sourcepub fn redact(self, redact: fn(&Key) -> Redaction) -> Self
pub fn redact(self, redact: fn(&Key) -> Redaction) -> Self
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.
Sourcepub fn print_msg(self, print: bool) -> Self
pub fn print_msg(self, print: bool) -> Self
Choose whether to print the log message.
The default prefix already prints it, so the default is to skip.
Sourcepub fn print_level(self, print: bool) -> Self
pub fn print_level(self, print: bool) -> Self
Choose whether to print the log level.
The default prefix already prints it, so the default is to skip.
Sourcepub fn print_tag(self, print: bool) -> Self
pub fn print_tag(self, print: bool) -> Self
Choose whether to print the log level.
The default prefix already prints it, so the default is to skip.
Sourcepub fn force_quotes(self) -> Self
pub fn force_quotes(self) -> Self
Force quoting field values even if they don’t contain quotable characters.
Setting this option will surround values with quotes like foo="bar"
.