Module tracing_log::log_tracer
source · Available on crate feature
log-tracer
only.Expand description
An adapter for converting log
records into tracing
Event
s.
This module provides the LogTracer
type which implements log
’s logger
interface by recording log records as tracing
Event
s. This is intended for
use in conjunction with a tracing
Subscriber
to consume events from
dependencies that emit log
records within a trace context.
Usage
To create and initialize a LogTracer
with the default configurations, use:
init
if you want to convert all logs, regardless of log level, allowing the tracingSubscriber
to perform any filteringinit_with_filter
to convert all logs up to a specified log level
In addition, a builder is available for cases where more advanced
configuration is required. In particular, the builder can be used to ignore
log records emitted by particular crates. This is useful in cases
such as when a crate emits both tracing
diagnostics and log records by
default.
Structs
- Configures a new
LogTracer
. - A simple “logger” that converts all log records into
tracing
Event
s. - The type returned by
set_logger
ifset_logger
has already been called.