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

chore: backport roughly a year's worth of changes #2728

Merged
merged 34 commits into from Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5048b86
mock: differentiate between mocks and expectations (#2373)
hds Nov 10, 2022
dc636df
mock: change helper functions to `expect::<thing>` (#2377)
hds Nov 11, 2022
9c6ffce
mock: add README to tracing-mock (#2362)
hds Nov 15, 2022
5db72b6
attributes: update `async_instrument` error text for Rust 1.66 (#2427)
hds Dec 27, 2022
e8b3795
mock: document public APIs in `event` module (#2426)
hds Jan 5, 2023
cbcfbf9
mock: document public APIs in `subscriber` module (#2446)
hds Jan 26, 2023
516392c
docs: fix typo in `panic_hook` example (#2453)
arifd Feb 8, 2023
d55ce3d
chore: bump MSRV to 1.56 (#2546)
davidbarsky Apr 5, 2023
bcaeaa9
core: add `ValueSet::len` and `Record::len` (#2152)
jamesmunns Jun 7, 2022
bb81c7e
mock: document public API in collector module (#2389)
hds Jun 24, 2023
0b31599
tracing: use fully qualified names in macros for items exported from …
hlbarber Jul 11, 2023
ddb1b8a
chores: fix clippy lints (#2673)
davidbarsky Aug 3, 2023
8e77a43
tracing: add tracing-cloudwatch to related cates in README (#2667)
ymgyt Aug 7, 2023
5952e36
documentation: Add article and talk by hoverbear (#2679)
Hoverbear Aug 9, 2023
8cb22ff
core: ensure callsites in test have unique addresses (#2681)
nikic Aug 14, 2023
2ee84b3
docs(field): remove duplicate wording (#2674)
alextes Aug 14, 2023
1fa24df
docs: Add `clippy-tracing` to related crates (#2628)
JonathanWoollett-Light Aug 14, 2023
5da7799
tracing: fix `wasm_bindgen_test` macros (#2675)
hlbarber Aug 17, 2023
bbc87fe
subscriber: support `NO_COLOR` in `fmt::Layer` (#2647)
dmlary Aug 17, 2023
95b1d5c
chore: fix new warnings in Rust 1.72.0 (#2700)
hawkw Aug 29, 2023
316c5a1
attributes: fix instrument with "log" feature (#2599)
miwig Sep 5, 2023
7d63c84
appender: clarify file appender docs (#2689)
CLEckhardt Sep 5, 2023
e4bb093
flame: fix folded formatting (#2710)
conectado Sep 5, 2023
b658b1f
attributes: generate less dead code for async block return type hint …
kornelski Sep 5, 2023
b0e3c71
core: allow `ValueSet`s of any length (#2508)
eopb Sep 5, 2023
3b1851d
tracing: allow setting event names in macros (#2699)
twitchax Sep 5, 2023
a0a176e
journald: allow custom journal fields (#2708)
Finomnis Sep 5, 2023
0687403
tracing: allow constant field names in macros (#2617)
wyfo Sep 5, 2023
75f0dbf
docs: add `axum-insights` to relevant crates. (#2713)
twitchax Sep 6, 2023
66d96cd
[tracing-subscriber]: add chrono crate implementations of FormatTime …
shayne-fletcher Sep 25, 2023
ffb1b11
test: remove potentially problematic test (#2728)
davidbarsky Sep 27, 2023
b661e84
attributes: bump minimum version of proc-macro2 to 1.0.60 (#2732)
davidbarsky Sep 28, 2023
f875c16
subscriber: Implement layer::Filter for Option<Filter> (#2407)
jsgf Sep 28, 2023
aa51104
docs: remove usage of 0.2 terminology (#2728)
davidbarsky Sep 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Expand Up @@ -369,6 +369,7 @@ are not maintained by the `tokio` project. These include:
- [`tracing-actix-web`] provides `tracing` integration for the `actix-web` web framework.
- [`tracing-actix`] provides `tracing` integration for the `actix` actor
framework.
- [`axum-insights`] provides `tracing` integration and Application insights export for the `axum` web framework.
- [`tracing-gelf`] implements a subscriber for exporting traces in Greylog
GELF format.
- [`tracing-coz`] provides integration with the [coz] causal profiler
Expand Down Expand Up @@ -401,6 +402,8 @@ are not maintained by the `tokio` project. These include:
- [`tracing-logfmt`] provides a layer that formats events and spans into the logfmt format.
- [`tracing-chrome`] provides a layer that exports trace data that can be viewed in `chrome://tracing`.
- [`reqwest-tracing`] provides a middleware to trace [`reqwest`] HTTP requests.
- [`tracing-cloudwatch`] provides a layer that sends events to AWS CloudWatch Logs.
- [`clippy-tracing`] provides a tool to add, remove and check for `tracing::instrument`.

(if you're the maintainer of a `tracing` ecosystem crate not in this list,
please let us know!)
Expand All @@ -411,6 +414,7 @@ please let us know!)
[honeycomb.io]: https://www.honeycomb.io/
[`tracing-actix`]: https://crates.io/crates/tracing-actix
[`tracing-actix-web`]: https://crates.io/crates/tracing-actix-web
[`axum-insights`]: https://crates.io/crates/axum-insights
[`tracing-gelf`]: https://crates.io/crates/tracing-gelf
[`tracing-coz`]: https://crates.io/crates/tracing-coz
[coz]: https://github.com/plasma-umass/coz
Expand Down Expand Up @@ -443,6 +447,8 @@ please let us know!)
[`tracing-chrome`]: https://crates.io/crates/tracing-chrome
[`reqwest-tracing`]: https://crates.io/crates/reqwest-tracing
[`reqwest`]: https://crates.io/crates/reqwest
[`tracing-cloudwatch`]: https://crates.io/crates/tracing-cloudwatch
[`clippy-tracing`]: https://crates.io/crates/clippy-tracing

**Note:** that some of the ecosystem crates are currently unreleased and
undergoing active development. They may be less stable than `tracing` and
Expand All @@ -458,14 +464,17 @@ Tracing.
* [Diagnostics with Tracing][tokio-blog-2019-08] on the Tokio blog, August 2019
* [Production-Grade Logging in Rust Applications][production-logging-2020], November 2020
* [Custom Logging in Rust using `tracing` and `tracing-subscriber`, part 1][custom-logging-part-1] and [part 2][custom-logging-part-2], October 2021
* [Instrumenting Axum projects][detsys-blog-2023-08], August 2023

[tokio-blog-2019-08]: https://tokio.rs/blog/2019-08-tracing/
[detsys-blog-2023-08]: https://determinate.systems/posts/instrumenting-axum

#### Talks

* [Bay Area Rust Meetup talk and Q&A][bay-rust-2019-03], March 2019
* [RustConf 2019 talk][rust-conf-2019-08-video] and [slides][rust-conf-2019-08-slides], August 2019
* [Are we observable yet? @ RustyDays talk][rusty-days-2020-08-video] and [slides][rusty-days-2020-08-slides], August 2020
* [Crabs with instruments!][tremorcon-2021-09], September 2021

[bay-rust-2019-03]: https://www.youtube.com/watch?v=j_kXRg3zlec
[rust-conf-2019-08-video]: https://www.youtube.com/watch?v=JjItsfqFIdo
Expand All @@ -475,6 +484,7 @@ Tracing.
[production-logging-2020]: https://medium.com/better-programming/production-grade-logging-in-rust-applications-2c7fffd108a6
[custom-logging-part-1]: https://burgers.io/custom-logging-in-rust-using-tracing
[custom-logging-part-2]: https://burgers.io/custom-logging-in-rust-using-tracing-part-2
[tremorcon-2021-09]: https://www.youtube.com/watch?v=ZC7fyqshun8

Help us expand this list! If you've written or spoken about Tracing, or
know of resources that aren't listed, please open a pull request adding them.
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/fmt-compact.rs
Expand Up @@ -7,7 +7,7 @@ fn main() {
.compact()
// enable everything
.with_max_level(tracing::Level::TRACE)
// sets this to be the default, global collector for this application.
// sets this to be the default, global subscriber for this application.
.init();

let number_of_yaks = 3;
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/fmt-source-locations.rs
Expand Up @@ -14,7 +14,7 @@ fn main() {
.with_line_number(true)
// disable targets
.with_target(false)
// sets this to be the default, global collector for this application.
// sets this to be the default, global subscriber for this application.
.init();

let number_of_yaks = 3;
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/panic_hook.rs
Expand Up @@ -30,7 +30,7 @@ fn main() {
// On nightly Rust, where the `PanicInfo` type also exposes a
// `message()` method returning just the message, we could record
// just the message instead of the entire `fmt::Display`
// implementation, avoiding the duplciated location
// implementation, avoiding the duplicated location
tracing::error!(
message = %panic,
panic.file = location.file(),
Expand Down
1 change: 1 addition & 0 deletions netlify.toml
Expand Up @@ -8,6 +8,7 @@
[build.environment]
RUSTDOCFLAGS="""
-D warnings \
--force-warn rustdoc::redundant-explicit-links \
--force-warn renamed-and-removed-lints \
--cfg docsrs \
--cfg tracing_unstable
Expand Down
26 changes: 20 additions & 6 deletions tracing-appender/src/lib.rs
Expand Up @@ -26,20 +26,34 @@
//! - Using a combination of [`NonBlocking`][non_blocking] and [`RollingFileAppender`][rolling_struct] to allow writes to a log file
//! without blocking.
//!
//! ## Rolling File Appender
//! ## File Appender
//!
//! The [`rolling` module][rolling] provides functions to create rolling and non-rolling file
//! appenders.
//!
//! Rolling file appender rotation options are [`Rotation::MINUTELY`](rolling::Rotation::MINUTELY),
//! [`Rotation::HOURLY`](rolling::Rotation::HOURLY), and
//! [`Rotation::DAILY`](rolling::Rotation::DAILY).
//!
//! To create a non-rolling file appender, use
//! [`tracing_appender::rolling::never(/*...*/)`](rolling::never) or
//! [`Rotation::NEVER`](rolling::Rotation::NEVER).
//!
//! The following example creates an hourly rotating file appender that writes to
//! `/some/directory/prefix.log.YYYY-MM-DD-HH`:
//!
//! ```rust
//! # fn docs() {
//! let file_appender = tracing_appender::rolling::hourly("/some/directory", "prefix.log");
//! # }
//! ```
//! This creates an hourly rotating file appender that writes to `/some/directory/prefix.log.YYYY-MM-DD-HH`.
//! [`Rotation::DAILY`](rolling::Rotation::DAILY) and [`Rotation::NEVER`](rolling::Rotation::NEVER) are the other available options.
//!
//! The file appender implements [`std::io::Write`][write]. To be used with [`tracing_subscriber::FmtSubscriber`][fmt_subscriber],
//! it must be combined with a [`MakeWriter`][make_writer] implementation to be able to record tracing spans/event.
//! The file appender implements [`std::io::Write`][write]. To be used with
//! [`tracing_subscriber::FmtSubscriber`][fmt_subscriber], it must be combined with a
//! [`MakeWriter`][make_writer] implementation to be able to record tracing spans/event.
//!
//! The [`rolling` module][rolling]'s documentation provides more detail on how to use this file appender.
//! See the [`rolling` module][rolling]'s documentation for more detail on how to use this file
//! appender.
//!
//! ## Non-Blocking Writer
//!
Expand Down
10 changes: 5 additions & 5 deletions tracing-appender/src/rolling.rs
Expand Up @@ -264,7 +264,7 @@ impl fmt::Debug for RollingFileAppender {
}
}

/// Creates a minutely, rolling file appender. This will rotate the log file once per minute.
/// Creates a minutely-rotating file appender. This will rotate the log file once per minute.
///
/// The appender returned by `rolling::minutely` can be used with `non_blocking` to create
/// a non-blocking, minutely file appender.
Expand Down Expand Up @@ -299,7 +299,7 @@ pub fn minutely(
RollingFileAppender::new(Rotation::MINUTELY, directory, file_name_prefix)
}

/// Creates an hourly, rolling file appender.
/// Creates an hourly-rotating file appender.
///
/// The appender returned by `rolling::hourly` can be used with `non_blocking` to create
/// a non-blocking, hourly file appender.
Expand Down Expand Up @@ -334,7 +334,7 @@ pub fn hourly(
RollingFileAppender::new(Rotation::HOURLY, directory, file_name_prefix)
}

/// Creates a file appender that rotates daily.
/// Creates a daily-rotating file appender.
///
/// The appender returned by `rolling::daily` can be used with `non_blocking` to create
/// a non-blocking, daily file appender.
Expand Down Expand Up @@ -370,13 +370,13 @@ pub fn daily(
RollingFileAppender::new(Rotation::DAILY, directory, file_name_prefix)
}

/// Creates a non-rolling, file appender
/// Creates a non-rolling file appender.
///
/// The appender returned by `rolling::never` can be used with `non_blocking` to create
/// a non-blocking, non-rotating appender.
///
/// The location of the log file will be specified the `directory` passed in.
/// `file_name` specifies the prefix of the log file. No date or time is appended.
/// `file_name` specifies the complete name of the log file (no date or time is appended).
///
/// # Examples
///
Expand Down
2 changes: 1 addition & 1 deletion tracing-attributes/Cargo.toml
Expand Up @@ -39,7 +39,7 @@ proc-macro = true
async-await = []

[dependencies]
proc-macro2 = "1.0.40"
proc-macro2 = "1.0.60"
syn = { version = "2.0", default-features = false, features = ["full", "parsing", "printing", "visit-mut", "clone-impls", "extra-traits", "proc-macro"] }
quote = "1.0.20"

Expand Down
8 changes: 4 additions & 4 deletions tracing-attributes/src/expand.rs
Expand Up @@ -66,11 +66,11 @@ pub(crate) fn gen_function<'a, B: ToTokens + 'a>(
let fake_return_edge = quote_spanned! {return_span=>
#[allow(
unknown_lints, unreachable_code, clippy::diverging_sub_expression,
clippy::let_unit_value, clippy::unreachable, clippy::let_with_type_underscore
clippy::let_unit_value, clippy::unreachable, clippy::let_with_type_underscore,
clippy::empty_loop
)]
if false {
let __tracing_attr_fake_return: #return_type =
unreachable!("this is just for type inference, and is unreachable code");
let __tracing_attr_fake_return: #return_type = loop {};
return __tracing_attr_fake_return;
}
};
Expand Down Expand Up @@ -343,7 +343,7 @@ fn gen_block<B: ToTokens>(
// regression in case the level is enabled.
let __tracing_attr_span;
let __tracing_attr_guard;
if tracing::level_enabled!(#level) {
if tracing::level_enabled!(#level) || tracing::if_log_enabled!(#level, {true} else {false}) {
__tracing_attr_span = #span;
#follows_from
__tracing_attr_guard = __tracing_attr_span.enter();
Expand Down