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 · sourcefn borrow_mut(&mut self) -> &mut T
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>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more