Skip to content

Commit

Permalink
log: add ignored target prefixes to LogTracer (#215)
Browse files Browse the repository at this point in the history
## Motivation

People writing libraries using tracing may wish to expose regular `log`
support via the `tracing/log` feature. At the same time, to get tracing
support for crates using `log`, users may turn to
`tracing_log::LogTracer`. Enabling both means logging events twice.

## Solution

This branch adds a `Builder` to the `tracing_log::LogTracer` type, which
allows configuring the `LogTracer` to ignore log records with targets
beginning with a certain string. This can be used to ignore any crates
which are emitting log records via the `tracing/log` feature. 

Ideally, we would provide a way to do this automatically, without
requiring configuration, but that'll take some thinking. The ability to
ignore certain sets of log records may be valuable even if we have an
automatic method for crates to signal that they are using the
`tracing/log` feature in the future.

I've also moved the `LogTracer` and `TraceLogger` types in `tracing-log`
out of `lib.rs` into their own modules, since the main lib file was
getting a bit lengthy.

Refs: #204

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
  • Loading branch information
hawkw committed Jul 23, 2019
1 parent 895596f commit 7e6cbf7
Show file tree
Hide file tree
Showing 3 changed files with 617 additions and 579 deletions.

0 comments on commit 7e6cbf7

Please sign in to comment.