Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracing: Make tracing-attributes (and syn) optional #603

Merged
merged 5 commits into from
Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tracing/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Unreleased

### Changed

- The `instrument` attribute was placed under an on-by-default feature
flag (#603)

# 0.1.12 (January 11, 2019)

### Added
Expand Down
5 changes: 3 additions & 2 deletions tracing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ edition = "2018"
[dependencies]
tracing-core = { path = "../tracing-core", version = "0.1.10", default-features = false }
log = { version = "0.4", optional = true }
tracing-attributes = { path = "../tracing-attributes", version = "0.1.6"}
tracing-attributes = { path = "../tracing-attributes", version = "0.1.6", optional = true }
cfg-if = "0.1.10"

[dev-dependencies]
Expand All @@ -38,7 +38,7 @@ criterion = { version = "0.3", default_features = false }
log = "0.4"

[features]
default = ["std"]
default = ["std", "attributes"]

max_level_off = []
max_level_error = []
Expand All @@ -59,6 +59,7 @@ async-await = []

std = ["tracing-core/std"]
log-always = ["log"]
attributes = ["tracing-attributes"]

[[bench]]
name = "subscriber"
Expand Down
9 changes: 8 additions & 1 deletion tracing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@
//! fields using `fmt::Debug`.
//!
//! For example:
//! ```
//! ```ignore
//! # // this doctest is ignored because we don't have a way to say
//! # // that it should only be run with cfg(feature = "attributes")
//! use tracing::{Level, event, instrument};
//!
//! #[instrument]
Expand Down Expand Up @@ -654,6 +656,9 @@
//! applications which intend to collect traces and logs separately; if an
//! adapter is used to convert `log` records into `tracing` events, this will
//! cause duplicate events to occur.
//! * `attributes`: Includes support for the `#[instrument]` attribute.
//! This is on by default, but does bring in the `syn` crate as a dependency,
//! which may add to the compile time of crates that do not already use it.
//! * `std`: Depend on the Rust standard library (enabled by default).
//!
//! `no_std` users may disable this feature with `default-features = false`:
Expand Down Expand Up @@ -753,6 +758,8 @@ pub use self::{

#[doc(inline)]
pub use self::span::Span;
#[cfg(feature = "attributes")]
jonhoo marked this conversation as resolved.
Show resolved Hide resolved
#[cfg_attr(docsrs, doc(cfg(feature = "attributes")))]
#[doc(inline)]
pub use tracing_attributes::instrument;

Expand Down