pub struct Json { /* private fields */ }
Expand description
Marker for Format
that indicates that the verbose json log format should be used.
The full format includes fields from all entered spans.
Example Output
ⓘ
{
"timestamp":"Feb 20 11:28:15.096",
"level":"INFO",
"fields":{"message":"some message","key":"value"}
"target":"mycrate",
"span":{name":"leaf"},
"spans":[{"name":"root"},{"name":"leaf"}],
}
Options
Json::flatten_event
can be used to enable flattening event fields into the rootJson::with_current_span
can be used to control logging of the current spanJson::with_span_list
can be used to control logging of the span list object.
By default, event fields are not flattened, and both current span and span list are logged.
Implementations
sourceimpl Json
impl Json
sourcepub fn flatten_event(&mut self, flatten_event: bool)
pub fn flatten_event(&mut self, flatten_event: bool)
If set to true
event metadata will be flattened into the root object.
sourcepub fn with_current_span(&mut self, display_current_span: bool)
pub fn with_current_span(&mut self, display_current_span: bool)
If set to false
, formatted events won’t contain a field for the current span.
sourcepub fn with_span_list(&mut self, display_span_list: bool)
pub fn with_span_list(&mut self, display_span_list: bool)
If set to false
, formatted events won’t contain a list of all currently
entered spans. Spans are logged in a list from root to leaf.
Trait Implementations
impl Copy for Json
impl Eq for Json
impl StructuralEq for Json
impl StructuralPartialEq for Json
Auto Trait Implementations
impl RefUnwindSafe for Json
impl Send for Json
impl Sync for Json
impl Unpin for Json
impl UnwindSafe for Json
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more