pub struct SubscriberBuilder { /* private fields */ }
Expand description

Builder for the trace_tools subscriber.

This can be used to enable/disable Layers provided by this crate.

Implementations

Enables the LogLayer for this subscriber, using the parameters provided by the given LoggerConfig.

Enables the LogLayer for this subscriber, using the default configuration.

Enables the FlamegraphLayer 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
Notes
  • This method calls the collect_logs function. Any log records emitted will be converting into tracing events, and therefore any external functionality that deals with log 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 external Layers.

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
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. Any log records emitted will be converting into tracing events, and therefore any external functionality that deals with log 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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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