Struct tracing_fluentd::Builder
source · [−]Expand description
Builder to enable forwarding tracing
events towards the fluentd
server.
Type params
F
- Attributes formatter, determines how to composefluent::Record
.A
- function that returnsFluentd
wrter. Default is to create tcp socket towards127.0.0.1:24224
with timeout of 1s.
Implementations
sourceimpl<A: MakeWriter> Builder<NestedFmt, A>
impl<A: MakeWriter> Builder<NestedFmt, A>
sourcepub fn flatten(self) -> Builder<FlattenFmt, A>
pub fn flatten(self) -> Builder<FlattenFmt, A>
Configures to flatten span/metadata attributes within record. Instead of the default nesting behavior.
sourceimpl<F: FieldFormatter, A: MakeWriter> Builder<F, A>
impl<F: FieldFormatter, A: MakeWriter> Builder<F, A>
sourcepub fn with_formatter<NF: FieldFormatter>(self, fmt: NF) -> Builder<NF, A>
pub fn with_formatter<NF: FieldFormatter>(self, fmt: NF) -> Builder<NF, A>
Provides callback to get writer where to write records.
Normally fluentd server expects connection to be closed immediately upon sending records. hence created writer is dropped immediately upon writing being finished.
sourcepub fn with_writer<MW: MakeWriter>(self, writer: MW) -> Builder<F, MW>
pub fn with_writer<MW: MakeWriter>(self, writer: MW) -> Builder<F, MW>
Provides callback to get writer where to write records.
Normally fluentd server expects connection to be closed immediately upon sending records. hence created writer is dropped immediately upon writing being finished.
sourcepub fn layer(self) -> Result<Layer<F, ThreadWorker>, Error>
pub fn layer(self) -> Result<Layer<F, ThreadWorker>, Error>
Creates tracing
layer.
If you do not want to create multiple threads, consider using
layer_guarded
/layer_from_guard
.
Error
can happen during creation of worker thread.
sourcepub fn layer_guarded(
self
) -> Result<(Layer<F, WorkerChannel>, FlushingGuard), Error>
pub fn layer_guarded(
self
) -> Result<(Layer<F, WorkerChannel>, FlushingGuard), Error>
Creates tracing
layer, returning guard that allows to stop fluentd
worker on Drop
.
This may be necessary due to bad API that tracing
provides to control lifetime of global
logger. As underlying implementations employs caching, it needs to perform flush once logger
is no longer necessary hence this API is provided.
Error
can happen during creation of worker thread.
sourcepub fn layer_from_guard(self, guard: &FlushingGuard) -> Layer<F, WorkerChannel>
pub fn layer_from_guard(self, guard: &FlushingGuard) -> Layer<F, WorkerChannel>
Creates tracing
layer, using guard returned by layer_guarded
.
Specifically, it will use the same worker thread as first instance of layer_guarded
,
without affecting lifetime of guard
.
Hence once guard
is dropped, worker for all connected layers will stop sending logs.
Error
can happen during creation of worker thread.
Auto Trait Implementations
impl<F, A> RefUnwindSafe for Builder<F, A> where
A: RefUnwindSafe,
F: RefUnwindSafe,
impl<F, A> Send for Builder<F, A> where
A: Send,
F: Send,
impl<F, A> Sync for Builder<F, A> where
A: Sync,
F: Sync,
impl<F, A> Unpin for Builder<F, A> where
A: Unpin,
F: Unpin,
impl<F, A> UnwindSafe for Builder<F, A> where
A: UnwindSafe,
F: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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