pub struct WithBuildInfo<F>(pub F);Expand description
Event formatter that stamps node_version and node_commit onto every
JSON log line produced by the wrapped formatter.
Telemetry needs the running build on every document, not just the
startup line: a staged rollout is only readable if each log line can be
attributed to the build that wrote it. tracing_subscriber’s JSON
formatter has no hook for constant fields and span fields do not survive
tokio::spawn, so this wraps the formatter instead: the inner output is
rendered into a thread-local buffer, its closing brace is replaced with
BUILD_INFO_TAIL, and the result is copied to the real writer. Cost is
one memcpy per line on top of the serialisation the inner formatter
already does.
Only meaningful around a JSON formatter. If the inner output does not end
in } it is passed through untouched rather than corrupted.
Tuple Fields§
§0: FTrait Implementations§
Source§impl<S, N, F> FormatEvent<S, N> for WithBuildInfo<F>where
S: Subscriber + for<'a> LookupSpan<'a>,
N: for<'a> FormatFields<'a> + 'static,
F: FormatEvent<S, N>,
Available on crate feature logging only.
impl<S, N, F> FormatEvent<S, N> for WithBuildInfo<F>where
S: Subscriber + for<'a> LookupSpan<'a>,
N: for<'a> FormatFields<'a> + 'static,
F: FormatEvent<S, N>,
logging only.Source§fn format_event(
&self,
ctx: &FmtContext<'_, S, N>,
writer: Writer<'_>,
event: &Event<'_>,
) -> Result
fn format_event( &self, ctx: &FmtContext<'_, S, N>, writer: Writer<'_>, event: &Event<'_>, ) -> Result
Auto Trait Implementations§
impl<F> Freeze for WithBuildInfo<F>where
F: Freeze,
impl<F> RefUnwindSafe for WithBuildInfo<F>where
F: RefUnwindSafe,
impl<F> Send for WithBuildInfo<F>where
F: Send,
impl<F> Sync for WithBuildInfo<F>where
F: Sync,
impl<F> Unpin for WithBuildInfo<F>where
F: Unpin,
impl<F> UnsafeUnpin for WithBuildInfo<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for WithBuildInfo<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more