Struct trace_tools::subscriber::SubscriberBuilder
source · [−]pub struct SubscriberBuilder { /* private fields */ }
Expand description
Builder for the trace_tools
subscriber.
This can be used to enable/disable Layer
s provided by this crate.
Implementations
Enables the LogLayer
for this subscriber, using the parameters provided by the
given LoggerConfig
.
Enables the FlamegraphFilteredLayer
for this subscriber.
The given path describes the desired output location of the folded stack file that is generated by
this layer during runtime. This file can then be used to produce a flamegraph by a Flamegrapher
instance, or by the inferno
tool.
Builds and returns the TraceSubscriber
.
Errors
- Creation of the
FlamegraphFilteredLayer
failed. - Creation of the
LogLayer
failed.
Notes
- This method calls the
collect_logs
function. Anylog
records emitted will be converting intotracing
events, and therefore any external functionality that deals withlog
records may no longer function as expected. - This method does not set the global subscriber. As such, a call to
finish
can be used to further extend the return subscriber with externalLayer
s.
Builds the TraceSubscriber
and sets it as the global default subscriber.
Returns a Result
over an Option<Flamegrapher>
. The returned option is Some
if
the LogLayer
is enabled and has been successfully initialised. If the
`LogLayer has not been enabled with the builder, it is fine to ignore this value.
Errors
- Creation of the
FlamegraphFilteredLayer
failed. - Creation of the
LogLayer
failed.
Panics
This method will panic if the flamegraph layer is enabled and the program is not built with
--cfg tokio_unstable
.
Notes
- This method calls the
collect_logs
function. Anylog
records emitted will be converting intotracing
events, and therefore any external functionality that deals withlog
records may no longer function as expected. - This method sets the global subscriber. Any further attempts to set the global subscriber (including another call to this method) will fail.
- The subscriber initialised by this method cannot be extended.
Trait Implementations
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for SubscriberBuilder
impl Send for SubscriberBuilder
impl Sync for SubscriberBuilder
impl Unpin for SubscriberBuilder
impl UnwindSafe for SubscriberBuilder
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more