Struct tracing_subscriber::fmt::format::Json
source · 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§
source§impl 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§
source§impl PartialEq<Json> for Json
impl PartialEq<Json> for Json
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more