pub struct Glog<T = UtcTime> { /* private fields */ }
Expand description
A glog-inspired span and event formatter.
Implementations§
Source§impl<T> Glog<T>
impl<T> Glog<T>
Sourcepub fn with_timer<T2>(self, timer: T2) -> Glog<T2>where
T2: FormatTime,
pub fn with_timer<T2>(self, timer: T2) -> Glog<T2>where
T2: FormatTime,
pub fn with_thread_names(self, with_thread_names: bool) -> Glog<T>
pub fn with_target(self, with_target: bool) -> Glog<T>
Sourcepub fn with_span_names(self, with_span_names: bool) -> Glog<T>
pub fn with_span_names(self, with_span_names: bool) -> Glog<T>
Sets whether or not the span name is included. Defaults to true.
If span names are not included, then the fields from all spans are printed as a single list of fields. This results is a more compact output.
§Example Output
With with_span_names
set to true:
I0731 16:23:45.674465 990039 examples/tokio.rs:38] [parent_task{subtasks: 10, reason: "testing"}, subtask{number: 10}] polling subtask, number: 10
With with_span_names
set to false:
I0731 16:23:45.674465 990039 examples/tokio.rs:38] [subtasks: 10, reason: "testing", number: 10] polling subtask, number: 10
Sourcepub fn with_span_context(self, with_span_context: bool) -> Glog<T>
pub fn with_span_context(self, with_span_context: bool) -> Glog<T>
Sets whether or not the span context is included. Defaults to true.
By default, formatters building atop of tracing_subscriber::fmt
will include the span context as fmt::Layer
and
fmt::Subscriber
assume that span context is
is valuable and the raison d’être for using tracing
and, as such, do not provide a
toggle. However, users migrating from logging systems such
as glog or folly’s xlog
might find the span context to be overwhelming. Therefore, this formatter-level toggle
is availible in order to provide a smoother onboarding experience to tracing
.
Notice: This is a relatively coarse toggle. In most circumstances, usage of
tracing-subscriber
’s filter_fn
is preferred to disable spans on a more
fine-grained basis.
Sourcepub fn with_format_level_chars(
self,
level_chars: &'static FormatLevelChars,
) -> Glog<T>
pub fn with_format_level_chars( self, level_chars: &'static FormatLevelChars, ) -> Glog<T>
Sets the characters to use to indicate the level for each event. Defaults to the initial character of the level.