Struct bflog::ContextWriter
source · pub struct ContextWriter<'a> { /* private fields */ }
Expand description
Temporary structure that can write additional context to a log entry.
Implementations§
source§impl<'a> ContextWriter<'a>
impl<'a> ContextWriter<'a>
sourcepub fn pretty(&mut self) -> &mut Self
pub fn pretty(&mut self) -> &mut Self
Sets the context writer to “pretty” mode, which outputs each context item on a separate line with pretty formatting.
sourcepub fn with<V: Serialize>(&mut self, key: &str, value: &V) -> &mut Self
pub fn with<V: Serialize>(&mut self, key: &str, value: &V) -> &mut Self
Adds a context item with a given key
and value
to the log entry.
This method is identical to write
but is better named when the method
is repeatedly chained from a logger method.