-
Notifications
You must be signed in to change notification settings - Fork 721
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
backport recent subscriber and attributes changes #1300
Commits on Mar 12, 2021
-
subscriber: use struct update syntax when constructing from
self
(#……1289) This backports #1289 from `master`. This PR aims to remove a lot of initializer boilerplate code by adopting the`struct update syntax. If the [RFC 2528] gets merged and implemented, we can remove more. 😸 [RFC 2528]: rust-lang/rfcs#2528
Configuration menu - View commit details
-
Copy full SHA for 94ba9c0 - Browse repository at this point
Copy the full SHA 94ba9c0View commit details -
subscriber: remove unnecessary transparent attribute (#1282)
As far as I can tell, we are not relying on transparency anywhere, so using this rather refined feature here is confusing.
Configuration menu - View commit details
-
Copy full SHA for e754ee9 - Browse repository at this point
Copy the full SHA e754ee9View commit details -
subscriber: Add a public
current_span()
method forFmtContext
(#1290) This backports PR #1290 from `master`.
Configuration menu - View commit details
-
Copy full SHA for 96ad780 - Browse repository at this point
Copy the full SHA 96ad780View commit details -
attributes: fix
#[instrument]
skipping code when returning pinned f…Configuration menu - View commit details
-
Copy full SHA for a933bb7 - Browse repository at this point
Copy the full SHA a933bb7View commit details -
subscriber: fix extra padding in pretty format (#1275)
## Motivation This fixes #1212, where extra padding was written when logging with the pretty formatter. ## Solution With this change we only write padding when we actually decide to write a value but not when skipping a metadata value such as `log.file` or `log.line`
Configuration menu - View commit details
-
Copy full SHA for 73b472e - Browse repository at this point
Copy the full SHA 73b472eView commit details -
subscriber: change
FmtSpan
to a combinable bitflag (#1277)This backports #1277 from `master`. Fixes #1136. Allows arbitrarily combining different FmtSpan events to listen to. Motivation ---------- The idea is to allow any combination of `FmtSpan` options, such as the currently unachievable combination of `FmtSpan::NEW | FmtSpan::CLOSE`. Solution -------- Make `FmtSpan` behave like a bitflag that can be combined using the bitwise or operator ( `|` ) while maintaining backward compatibility by keeping the same names for all existing presets and keeping the implementation details hidden.
Configuration menu - View commit details
-
Copy full SHA for 4ac4e8c - Browse repository at this point
Copy the full SHA 4ac4e8cView commit details -
subscriber: update pretty formatter for no ansi (#1240)
This backports #1240 from `master`. * subscriber: update pretty formatter for no ansi ## Background Currently, when the `Pretty` event formatter is being used, it does not change its output when the `with_ansi` flag is set to false by the `CollectorBuilder`. ## Overview While this formatter is generally used in situations such as local development, where ANSI escape codes are more often acceptable, there are some situations in which this can lead to mangled output. This commit makes some minor changes to account for this `ansi` flag when formatting events using `Pretty`. Becuase ANSI codes were previously used to imply the event level using colors, this commit additionally modifies `Pretty` so that it respects `display_level` when formatting an event. ## Changes * Changes to `<Format<Pretty, T> as FormatEvent<C, N>>::format_event` * Add a `PrettyVisitor::ansi` boolean flag, used in its `Visit` implementation. * Add a new `PrettyVisitor::with_ansi` builder pattern method to facilitate this. ## Out of Scope One detail worth nothing is that this does not solve the problem of *fields* being formatted without ANSI codes. Configuring a subscriber using this snippet would still lead to bolded fields in parent spans. ```rust tracing_subscriber::fmt() .pretty() .with_ansi(false) .with_level(false) .with_max_level(tracing::Level::TRACE) .init(); ``` This can be worked around by using a different field formatter, via `.fmt_fields(tracing_subscriber::fmt::format::DefaultFields::new())` in the short-term. In the long-term, #658 is worth investigating further. Refs: #658
Configuration menu - View commit details
-
Copy full SHA for 19c08ca - Browse repository at this point
Copy the full SHA 19c08caView commit details