Skip to content

Commit 1c802c7

Browse files
davidbarskyhawkw
andauthored
log: remove deprecated env_logger and trace_logger APIs (#2771)
Removing the `env_logger` feature in order to address GHSA-g98v-hv3f-hcfr. In addition, this PR also removes the deprecated `trace_logger` module, in preparation for an upcoming v0.2.0 of `tracing-log`. For additional details on the approach, please refer to #2750. Note that this PR depends on #2770, so this PR will temporarily have more commits than intended. --------- Co-authored-by: Eliza Weisman <[email protected]>
1 parent 4965c36 commit 1c802c7

File tree

8 files changed

+15
-554
lines changed

8 files changed

+15
-554
lines changed

examples/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ tracing-tower = { version = "0.1.0", path = "../tracing-tower" }
1919
tracing-subscriber = { path = "../tracing-subscriber", version = "0.3.0", features = ["json", "env-filter"] }
2020
tracing-futures = { version = "0.2.1", path = "../tracing-futures", features = ["futures-01"] }
2121
tracing-attributes = { path = "../tracing-attributes", version = "0.1.22" }
22-
tracing-log = { path = "../tracing-log", version = "0.1.3", features = ["env_logger"] }
2322
tracing-serde = { path = "../tracing-serde" }
2423
tracing-appender = { path = "../tracing-appender", version = "0.2.0" }
2524
tracing-journald = { path = "../tracing-journald" }

tracing-log/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@ readme = "README.md"
1818
rust-version = "1.56.0"
1919

2020
[features]
21-
default = ["log-tracer", "trace-logger", "std"]
21+
default = ["log-tracer", "std"]
2222
std = ["log/std"]
2323
log-tracer = []
24-
trace-logger = []
2524
interest-cache = ["lru", "ahash"]
2625

2726
[dependencies]
2827
tracing-core = { path = "../tracing-core", version = "0.1.28"}
2928
log = { version = "0.4.17" }
3029
once_cell = "1.13.0"
31-
env_logger = { version = "0.8.4", optional = true }
3230
lru = { version = "0.7.7", optional = true }
3331
ahash = { version = "0.7.6", optional = true }
3432

tracing-log/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ This crate provides:
4343
- [`AsTrace`] and [`AsLog`] traits for converting between `tracing` and `log` types.
4444
- [`LogTracer`], a [`log::Log`] implementation that consumes [`log::Record`]s
4545
and outputs them as [`tracing::Event`]s.
46-
- An [`env_logger`] module, with helpers for using the [`env_logger` crate]
47-
with `tracing` (optional, enabled by the `env_logger` feature).
4846

4947
[`tracing`]: https://crates.io/crates/tracing
5048
[`log`]: https://crates.io/crates/log

tracing-log/src/env_logger.rs

Lines changed: 0 additions & 49 deletions
This file was deleted.

tracing-log/src/lib.rs

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
//! - [`AsTrace`] and [`AsLog`] traits for converting between `tracing` and `log` types.
1414
//! - [`LogTracer`], a [`log::Log`] implementation that consumes [`log::Record`]s
1515
//! and outputs them as [`tracing::Event`].
16-
//! - An [`env_logger`] module, with helpers for using the [`env_logger` crate]
17-
//! with `tracing` (optional, enabled by the `env-logger` feature).
1816
//!
1917
//! *Compiler support: [requires `rustc` 1.56+][msrv]*
2018
//!
@@ -57,23 +55,20 @@
5755
//!
5856
//! ## Caution: Mixing both conversions
5957
//!
60-
//! Note that logger implementations that convert log records to trace events
58+
//! Note that `log::Logger` implementations that convert log records to trace events
6159
//! should not be used with `Subscriber`s that convert trace events _back_ into
62-
//! log records (such as the `TraceLogger`), as doing so will result in the
63-
//! event recursing between the subscriber and the logger forever (or, in real
64-
//! life, probably overflowing the call stack).
60+
//! `log` records, as doing so will result in the event recursing between the subscriber
61+
//! and the logger forever (or, in real life, probably overflowing the call stack).
6562
//!
6663
//! If the logging of trace events generated from log records produced by the
6764
//! `log` crate is desired, either the `log` crate should not be used to
6865
//! implement this logging, or an additional layer of filtering will be
6966
//! required to avoid infinitely converting between `Event` and `log::Record`.
7067
//!
71-
//! # Feature Flags
72-
//! * `trace-logger`: enables an experimental `log` subscriber, deprecated since
73-
//! version 0.1.1.
68+
//! ## Feature Flags
69+
//!
70+
//! * `std`: enables features that require the Rust standard library (on by default)
7471
//! * `log-tracer`: enables the `LogTracer` type (on by default)
75-
//! * `env_logger`: enables the `env_logger` module, with helpers for working
76-
//! with the [`env_logger` crate].
7772
//! * `interest-cache`: makes it possible to configure an interest cache for
7873
//! logs emitted through the `log` crate (see [`Builder::with_interest_cache`]); requires `std`
7974
//!
@@ -94,7 +89,6 @@
9489
//! [`init`]: LogTracer::init
9590
//! [`init_with_filter`]: LogTracer::init_with_filter
9691
//! [`tracing`]: https://crates.io/crates/tracing
97-
//! [`env_logger` crate]: https://crates.io/crates/env-logger
9892
//! [`tracing::Subscriber`]: https://docs.rs/tracing/latest/tracing/trait.Subscriber.html
9993
//! [`Subscriber`]: https://docs.rs/tracing/latest/tracing/trait.Subscriber.html
10094
//! [`tracing::Event`]: https://docs.rs/tracing/latest/tracing/struct.Event.html
@@ -143,33 +137,11 @@ use tracing_core::{
143137
#[cfg_attr(docsrs, doc(cfg(feature = "log-tracer")))]
144138
pub mod log_tracer;
145139

146-
#[cfg(feature = "trace-logger")]
147-
#[cfg_attr(docsrs, doc(cfg(feature = "trace-logger")))]
148-
pub mod trace_logger;
149-
150140
#[cfg(feature = "log-tracer")]
151141
#[cfg_attr(docsrs, doc(cfg(feature = "log-tracer")))]
152142
#[doc(inline)]
153143
pub use self::log_tracer::LogTracer;
154144

155-
#[cfg(feature = "trace-logger")]
156-
#[cfg_attr(docsrs, doc(cfg(feature = "trace-logger")))]
157-
#[deprecated(
158-
since = "0.1.1",
159-
note = "use the `tracing` crate's \"log\" feature flag instead"
160-
)]
161-
#[allow(deprecated)]
162-
#[doc(inline)]
163-
pub use self::trace_logger::TraceLogger;
164-
165-
#[cfg(feature = "env_logger")]
166-
#[cfg_attr(docsrs, doc(cfg(feature = "env_logger")))]
167-
#[deprecated(
168-
since = "0.1.4",
169-
note = "use `tracing-subscriber`'s `fmt::Subscriber` instead"
170-
)]
171-
pub mod env_logger;
172-
173145
pub use log;
174146

175147
#[cfg(all(feature = "interest-cache", feature = "log-tracer", feature = "std"))]

0 commit comments

Comments
 (0)