Skip to content

Commit

Permalink
log: remove deprecated env_logger and trace_logger APIs (#2771)
Browse files Browse the repository at this point in the history
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 <eliza@buoyant.io>
  • Loading branch information
davidbarsky and hawkw authored Oct 24, 2023
1 parent 4965c36 commit 1c802c7
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 554 deletions.
1 change: 0 additions & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ tracing-tower = { version = "0.1.0", path = "../tracing-tower" }
tracing-subscriber = { path = "../tracing-subscriber", version = "0.3.0", features = ["json", "env-filter"] }
tracing-futures = { version = "0.2.1", path = "../tracing-futures", features = ["futures-01"] }
tracing-attributes = { path = "../tracing-attributes", version = "0.1.22" }
tracing-log = { path = "../tracing-log", version = "0.1.3", features = ["env_logger"] }
tracing-serde = { path = "../tracing-serde" }
tracing-appender = { path = "../tracing-appender", version = "0.2.0" }
tracing-journald = { path = "../tracing-journald" }
Expand Down
4 changes: 1 addition & 3 deletions tracing-log/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ readme = "README.md"
rust-version = "1.56.0"

[features]
default = ["log-tracer", "trace-logger", "std"]
default = ["log-tracer", "std"]
std = ["log/std"]
log-tracer = []
trace-logger = []
interest-cache = ["lru", "ahash"]

[dependencies]
tracing-core = { path = "../tracing-core", version = "0.1.28"}
log = { version = "0.4.17" }
once_cell = "1.13.0"
env_logger = { version = "0.8.4", optional = true }
lru = { version = "0.7.7", optional = true }
ahash = { version = "0.7.6", optional = true }

Expand Down
2 changes: 0 additions & 2 deletions tracing-log/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ This crate provides:
- [`AsTrace`] and [`AsLog`] traits for converting between `tracing` and `log` types.
- [`LogTracer`], a [`log::Log`] implementation that consumes [`log::Record`]s
and outputs them as [`tracing::Event`]s.
- An [`env_logger`] module, with helpers for using the [`env_logger` crate]
with `tracing` (optional, enabled by the `env_logger` feature).

[`tracing`]: https://crates.io/crates/tracing
[`log`]: https://crates.io/crates/log
Expand Down
49 changes: 0 additions & 49 deletions tracing-log/src/env_logger.rs

This file was deleted.

40 changes: 6 additions & 34 deletions tracing-log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
//! - [`AsTrace`] and [`AsLog`] traits for converting between `tracing` and `log` types.
//! - [`LogTracer`], a [`log::Log`] implementation that consumes [`log::Record`]s
//! and outputs them as [`tracing::Event`].
//! - An [`env_logger`] module, with helpers for using the [`env_logger` crate]
//! with `tracing` (optional, enabled by the `env-logger` feature).
//!
//! *Compiler support: [requires `rustc` 1.56+][msrv]*
//!
Expand Down Expand Up @@ -57,23 +55,20 @@
//!
//! ## Caution: Mixing both conversions
//!
//! Note that logger implementations that convert log records to trace events
//! Note that `log::Logger` implementations that convert log records to trace events
//! should not be used with `Subscriber`s that convert trace events _back_ into
//! log records (such as the `TraceLogger`), as doing so will result in the
//! event recursing between the subscriber and the logger forever (or, in real
//! life, probably overflowing the call stack).
//! `log` records, as doing so will result in the event recursing between the subscriber
//! and the logger forever (or, in real life, probably overflowing the call stack).
//!
//! If the logging of trace events generated from log records produced by the
//! `log` crate is desired, either the `log` crate should not be used to
//! implement this logging, or an additional layer of filtering will be
//! required to avoid infinitely converting between `Event` and `log::Record`.
//!
//! # Feature Flags
//! * `trace-logger`: enables an experimental `log` subscriber, deprecated since
//! version 0.1.1.
//! ## Feature Flags
//!
//! * `std`: enables features that require the Rust standard library (on by default)
//! * `log-tracer`: enables the `LogTracer` type (on by default)
//! * `env_logger`: enables the `env_logger` module, with helpers for working
//! with the [`env_logger` crate].
//! * `interest-cache`: makes it possible to configure an interest cache for
//! logs emitted through the `log` crate (see [`Builder::with_interest_cache`]); requires `std`
//!
Expand All @@ -94,7 +89,6 @@
//! [`init`]: LogTracer::init
//! [`init_with_filter`]: LogTracer::init_with_filter
//! [`tracing`]: https://crates.io/crates/tracing
//! [`env_logger` crate]: https://crates.io/crates/env-logger
//! [`tracing::Subscriber`]: https://docs.rs/tracing/latest/tracing/trait.Subscriber.html
//! [`Subscriber`]: https://docs.rs/tracing/latest/tracing/trait.Subscriber.html
//! [`tracing::Event`]: https://docs.rs/tracing/latest/tracing/struct.Event.html
Expand Down Expand Up @@ -143,33 +137,11 @@ use tracing_core::{
#[cfg_attr(docsrs, doc(cfg(feature = "log-tracer")))]
pub mod log_tracer;

#[cfg(feature = "trace-logger")]
#[cfg_attr(docsrs, doc(cfg(feature = "trace-logger")))]
pub mod trace_logger;

#[cfg(feature = "log-tracer")]
#[cfg_attr(docsrs, doc(cfg(feature = "log-tracer")))]
#[doc(inline)]
pub use self::log_tracer::LogTracer;

#[cfg(feature = "trace-logger")]
#[cfg_attr(docsrs, doc(cfg(feature = "trace-logger")))]
#[deprecated(
since = "0.1.1",
note = "use the `tracing` crate's \"log\" feature flag instead"
)]
#[allow(deprecated)]
#[doc(inline)]
pub use self::trace_logger::TraceLogger;

#[cfg(feature = "env_logger")]
#[cfg_attr(docsrs, doc(cfg(feature = "env_logger")))]
#[deprecated(
since = "0.1.4",
note = "use `tracing-subscriber`'s `fmt::Subscriber` instead"
)]
pub mod env_logger;

pub use log;

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

0 comments on commit 1c802c7

Please sign in to comment.