This release updates the tracing dependency to v0.1.41 and the tracing-serde dependency to v0.2.0.
set_span_events to fmt::Subscriber (#2962)&[u8] to be recorded as event/span field (#2954)log max level when reloading (#1270)thread_locals when possible (#2838)with_ansi() on the “ansi” feature (#3020)This release of tracing-subscriber adds support for the NO_COLOR environment variable (an informal standard to disable emitting ANSI color escape codes) in fmt::Layer, reintroduces support for the chrono crate, and increases the minimum supported Rust version (MSRV) to Rust 1.63.0.
It also introduces several minor API improvements.
chrono implementations of FormatTime (#2690)NO_COLOR environment variable in fmt::Layer (#2647)format::Writer::new() public (#2680)layer::Filter for Option<Filter> (#2407)tracing-log to 0.2 (#2772)Thanks to @shayne-fletcher, @dmlary, @kaifastromai, and @jsgf for contributing!
This release of tracing-subscriber fixes a build error when using env-filter with recent versions of the regex crate. It also introduces several minor API improvements.
regex dependency, fixing a build error with recent versions of regex (#2566)fmt::Display impl for filter::Targets (#2343)with_ansi(false) no longer require the “ansi” feature, so that ANSI formatting escapes can be disabled without requiring ANSI-specific dependencies (#2532)Compact formatter, matching the default formatter (#2409)Thanks to @keepsimple1, @andrewhalle, @LeoniePhiline, @LukeMathWalker, @howardjohn, @daxpedda, and @dbidwell94 for contributing to this release!
This release of tracing-subscriber fixes a regression introduced in v0.3.15 where Option::None's Layer implementation would set the max level hint to OFF. In addition, it adds several new APIs, including the Filter::event_enabled method for filtering events based on fields values, and the ability to log internal errors that occur when writing a log line.
This release also replaces the dependency on the unmaintained [ansi-term] crate with the [nu-ansi-term] crate, resolving an informational security advisory (RUSTSEC-2021-0139) for [ansi-term]'s maintainance status. This increases the minimum supported Rust version (MSRV) to Rust 1.50+, although the crate should still compile for the previous MSRV of Rust 1.49+ when the ansi feature is not enabled.
Option::None's Layer impl always setting the max_level_hint to LevelFilter::OFF (#2321)-Z minimal versions (#2246)tracing-subscriber (#2285)stderr if writing a log line fails (#2102)FmtLayer::log_internal_errors and FmtSubscriber::log_internal_errors methods for configuring whether internal writer errors are printed to stderr (#2102)#[must_use] attributes on builders to warn if a Subscriber is configured but not set as the default subscriber (#2239)Filter::event_enabled method for filtering an event based on its fields (#2245, #2251)Targets::default_level accessor ([#2242])ansi-term crate with nu-ansi-term ((#2287, fixes informational advisory RUSTSEC-2021-0139)tracing-core: updated to 0.1.30ansi) feature flag is enabled (#2287)fmt::init documentation (#2224)filter::Not combinator (#2249)Thanks to new contributors @cgbur, @DesmondWillowbrook, @RalfJung, and @poliorcetics, as well as returning contributors @CAD97, @connec, @jswrenn, @guswynn, and @bryangarza, for contributing to this release!
This release fixes a bug where the reload layer would fail to pass through max_level_hint to the underlying layer, potentially breaking filtering.
max_level_hint to the inner Layer (#2204)Thanks to @guswynn for contributing to this release!
This release fixes multiple filtering bugs in the Layer implementations for Option<impl Layer> and Vec<impl Layer>.
Layer::event_enabled implementation for Option<impl Layer<S>> returning false when the Option is None, disabling all events globally (#2193)Layer::max_level_hint implementation for Option<impl Layer<S>> incorrectly disabling max level filtering when the option is None (#2195)Layer::max_level_hint implementation for Vec<impl Layer<S>> returning LevelFilter::ERROR rather than LevelFilter::OFF when the Vec is empty (#2195)Thanks to @CAD97 and @guswynn for contributing to this release!
This release of tracing-subscriber fixes a compilation failure due to an incorrect tracing-core dependency that was introduced in v0.3.12.
This release of tracing-subscriber adds a new Layer::event_enabled method, which allows Layers to filter events after their field values are recorded; a Filter implementation for reload::Layer, to make using reload with per-layer filtering more ergonomic, and additional inherent method downcasting APIs for the Layered type. In addition, it includes dependency updates, and minor fixes for documentation and feature flagging.
Layer::event_enabled method, which can be implemented to filter events based on their field values (#2008)Filter implementation for reload::Layer (#2159)Layered::downcast_ref and Layered::is inherent methods (#2160)parking_lot to 0.13.0 (#2143)lazy_static dependency with once_cell ([#2147])tracing-core features by default (#2107)Thanks to @ben0x539, @jamesmunns, @georgemp, @james7132, @jswrenn, @CAD97, and @guswynn for contributing to this release!
This is a bugfix release for the Filter implementation for EnvFilter added in v0.3.10.
Filter::on_record callback to EnvFilter's Filter impl (#2058)EnvFilter methods with both the Filter and Layer traits in scope (#2057)EnvFilter::builder().parse() and other parsing methods returning an error when parsing an empty string (#2052)Thanks to new contributor @Ma124 for contributing to this release!
This release adds several new features, including a Filter implementation and new builder API for EnvFilter, support for using a Vec<L> where L: Layer as a Layer, and a number of smaller API improvements to make working with dynamic and reloadable layers easier.
Filter for EnvFilter, allowing it to be used with per-layer filtering (#1983)Filter::on_new_span, Filter::on_enter, Filter::on_exit, Filter::on_close and Filter::on_record callbacks to allow Filters to track span states internally (#1973, #2017, #2031)Filtered::filter and Filtered::filter_mut accessors (#1959)Filtered::inner and Filtered::inner_mut accessors to borrow the wrapped Layer (#2034)Layer for Vec<L: Layer>, to allow composing together a dynamically sized list of Layers (#2027)Layer::boxed method to make type-erasing Layers easier (#2026)fmt::Layer::writer and fmt::Layer::writer_mut accessors (#2034)fmt::Layer::set_ansi method to allow changing the ANSI formatting configuration at runtime (#2034)EnvFilter::builder to configure a new EnvFilter prior to parsing it (#2035)fmt::Layer‘s auto traits no longer depend on the Subscriber type parameter’s auto traits (#2025)ansi feature is disabled (#2029)Thanks to new contributors @TimoFreiberg and @wagenet, as well as @CAD97 for contributing to this release!
This release updates the minimum supported Rust version (MSRV) to 1.49.0, and updates the (optional) dependency on parking_lot to v0.12.
parking_lot: updated to v0.12 (008339d)This release adds experimental support for recording structured field values using the valuable crate to the format::Json formatter. In particular, user-defined types which are recorded using their valuable::Valuable implementations will be serialized as JSON objects, rather than using their fmt::Debug representation. See this blog post for details on valuable.
Note that valuable support currently requires --cfg tracing_unstable. See the documentation for details.
Additionally, this release includes a number of other smaller API improvements.
valuable values as structured JSON (#1862, #1901)Targets::would_enable method for testing if a Targets filter would enable a given target (#1903)map_event_format, map_fmt_fields, and map_writer methods to fmt::Layer and fmt::SubscriberBuilder (#1871)tracing-core: updated to 0.1.22smallvec minimal version to 1.2.0, to fix compilation errors with -Z minimal-versions (#1890)Thanks to @guswynn, @glts, and @lilyball for contributing to this release!
This release adds combinators for combining filters.
Additionally, this release also updates the thread-local crate to v1.1.4, fixing warnings for the security advisory RUSTSEC-2022-0006. Note that previous versions of tracing-subscriber did not use any of the thread-local crate's APIs effected by the vulnerability. However, updating the version fixes warnings emitted by cargo audit and similar tools.
thread-local to v1.1.4 (#1858)Thanks to new contributor @matze for contributing to this release!
This release adds configuration options to tracing_subscriber::fmt to log source code locations for events.
with_file and with_line_number configuration methods to fmt::Format, fmt::SubscriberBuilder, and fmt::Layer (#1773)Pretty formatter (#1833)Pretty::with_source_location, as it can now be replaced by the more general Format, SubscriberBuilder, and Layer methods (#1773)Thanks to new contributor @renecouto for contributing to this release!
This release re-enables RUST_LOG filtering in tracing_subscriber::fmt's default initialization methods, and adds an OffsetLocalTime formatter for using local timestamps with the time crate.
OffsetLocalTime formatter to fmt::time for formatting local timestamps with a fixed offset (#1772)Targets filter to fmt::init() and fmt::try_init() when the “env-filter” feature is disabled, so that RUST_LOG is still honored (#1781)Thanks to @marienz and @ishitatsuyuki for contributing to this release!
This release contains bugfixes for the fmt module, as well as documentation improvements.
fmt not emitting log lines when timestamp formatting fails (#1689)Pretty formatter (#1778)Thanks to new contributors @Swatinem and @rukai for contributing to this release!
This release fixes a pair of regressions in tracing-subscriber's fmt module.
Compact formatter (#1755)PrettyFields formatter (and thus format::Pretty event formatter) ignoring the fmt::Layer's ANSI color code configuration (#1747)MakeWriter filtering not working with BoxMakeWriter (#1694)Writer::has_ansi_escapes method to check if an output supports ANSI terminal formatting escape codes (#1696)FmtContext::span_scope, FmtContext::event_scope, and FmtContext::parent_span methods for accessing the current span and its scope when formatting an event (#1728)This release fixes a few issues related to feature flagging.
This is a breaking release of tracing-subscriber. The primary breaking change in this release is the removal of the dependency on the chrono crate, due to RUSTSEC-2020-0159. To replace chrono, support is added for formatting timestamps using the time crate instead.
In addition, this release includes a number of other breaking API changes, such as adding (limited) support for #![no_std] targets, removing previously deprecated APIs, and more.
Layer::new_span to Layer::on_new_span (#1674)Layer impl for Arc<L: Layer<S>> and Arc<dyn Layer<S> + ...> (#1649)chrono crate with the time crate for timestamp formatting, to resolve RUSTSEC-2020-0159 (#1646)json and env-filter from default features. They must now be enabled explictly (#1647). This means that RUST_LOG-based filters will not work unless the env-filter feature is enabled.FormatEvent::format_event and FormatFields::format_fields trait methods to take a Writer type, rather than a &mut dyn fmt::Write trait object (#1661)MakeWriter trait by adding a lifetime parameter (#781)Layer::new_span to Layer::on_new_span (#1674)FormatEvent::format_event and FormatFields::format_fields trait methods to take a Writer type, rather than a &mut dyn fmt::Write trait object (#1661)json and env-filter feature flags are no longer enabled by default (#1647)CurrentSpan type (#1320)SpanRef::parents iterator, replaced by SpanRef::scope in #1431 ([#1648)])Context::scope iterator, replaced by Context::span_scope and Context::event_scope in #1431 and #1434 ([#1648)])Layer impl for Arc<L: Layer<S>> and Arc<dyn Layer<S> + ...>. These interfere with per-layer filtering. (#1649)LayerBuilder type (#1673)fmt::Layer::on_event (renamed to fmt::Layer::fmt_event) (#1673)chrono feature flag and APIs for using the chrono crate for timestamp formatting (#1646)LocalTime and UtcTime types for formatting timestamps using the time crate (#1646)MakeWriter trait, allowing it to return a borrowed writer. This enables implementations of MakeWriter for types such as Mutex<T: io::Write> and std::fs::File. (#781)#![no_std] targets, by disabling the std feature flag (#1660)Thanks to @Folyd and @nmathewson for contributing to this release!
This release fixes an issue where a Layer implementation's custom downcast_raw implementation was lost when wrapping that layer with a per-layer filter.
Filtered::downcast_raw to wrapped Layer (#1619)Thanks to @bryanburgers for contributing to this release!
This release contains a number of bug fixes, including a fix for tracing-subscriber failing to compile on the minimum supported Rust version of 1.42.0. It also adds IntoIterator implementations for the Targets type.
enabled state is cleared when a global filter short-circuits filter evaluation (#1575)Layer::on_layer not being called for Boxed Layers, which broke per-layer filtering (#1576)Targets::iter, returning an iterator over the set of target-level pairs enabled by a Targets filter (#1574)IntoIterator implementations for Targets and &Targets (#1574)Thanks to new contributor @connec for contributing to this release!
This release fixes a few bugs in the per-layer filtering API added in v0.2.21.
EnvFilter memory use (#1568)This fixes a regression where the filter::ParseError type was accidentally renamed.
filter::ParseError accidentally being renamed to filter::DirectiveParseError (#1558)This release introduces the Filter trait, a new API for per-layer filtering. This allows controlling which spans and events are recorded by various layers individually, rather than globally.
In addition, it adds a new Targets filter, which provides a lighter-weight version of the filtering provided by EnvFilter, as well as other smaller API improvements and fixes.
SpanRef::parent_id, which cannot properly support per-layer filtering. Use .parent().map(SpanRef::id) instead. (#1523)Context methods that are provided when the Subscriber implements LookupSpan no longer require the “registry” feature flag (#1525)fmt::Debug implementation for Layered no longer requires the S type parameter to implement Debug (#1528)Filter trait, Filtered type, Layer::with_filter method, and other APIs for per-layer filtering (#1523)FilterFn and DynFilterFn types that implement global (Layer) and per-layer (Filter) filtering for closures and function pointers (#1523)Targets filter, which implements a lighter-weight form of EnvFilter-like filtering (#1550)Layer::on_layer callback, called when layering the Layer onto a Subscriber (#1523)Layer implementations for Box<L> and Arc<L> where L: Layer ([#1536])Layer implementations for Box<dyn Layer<S> + Send + Sync + 'static> and Arc<dyn Layer<S> + Send + Sync + 'static> ([#1536])Special thanks to new contributors @jsgf and @maxburke for contributing to this release!
fmt printing only the first source for errors with a chain of sources (#1460)Pretty formatter (#1498)Json formatter not honoring without_time and with_level configurations (#1463)Thanks to new contributors @joshtriplett and @lerouxrgd, and returning contributor @teozkr, for contributing to this release!
SpanRef::parents, SpanRef::from_root, and Context::scope iterators, which are replaced by new SpanRef::scope and Scope::from_root iterators (#1413)SpanRef::scope method, which returns a leaf-to-root Iterator including the leaf span (#1413)Scope::from_root method, which reverses the scope iterator to iterate root-to-leaf (#1413)Context::event_span method, which looks up the parent span of an event (#1434)Context::event_scope method, returning a Scope iterator over the span scope of an event (#1434)MakeWriter::make_writer_for method, which allows returning a different writer based on a span or event's metadata (#1141)MakeWriterExt trait, with with_max_level, with_min_level, with_filter, and, and or_else combinators (#1274)MakeWriter implementation for Arc<W> where &W: io::Write (#1274)Thanks to @teozkr and @Folyd for contributing to this release!
CurrentSpan type, which is inefficient and largely superseded by the registry API (#1321){ and ] (#1368)Thanks to @Folyd, and new contributors @akinnane and @aym-v for contributing to this release!
Pretty formatter now honors with_ansi(false) to disable ANSI terminal formatting (#1240)Pretty formatter (#1275)ChronoLocal time formatter (#1103)FmtContext::current_span() method, returning the current span (#1290)FmtSpan variants may now be combined using the | operator for more granular control over what span events are generated (#1277)Thanks to new contributors @cratelyn, @dignati, and @zicklag, as well as @Folyd, @matklad, and @najamelan, for contributing to this release!
Info) failing to parse (#1126)fmt::Subscriber not providing a max-level hint (#1251)tracing-subscriber no longer enables tracing and tracing-core's default features (#1144)chrono dependency to 0.4.16 (#1189)tracing-log dependency to 0.1.2Thanks to @salewski, @taiki-e, @davidpdrsn and @markdingram for contributing to this release!
FormatFields impl for FmtContext (#1082)format::Pretty, an aesthetically pleasing, human-readable event formatter for local development and user-facing CLIs (#1080)FmtContext::field_format, which returns the subscriber's field formatter (#1082)Registry::new allocating an excessively large amount of memory, most of which would never be used (#1064)new_span performance by reusing HashMap allocations for Extensions (#1064)Registry::enter and Registry::exit (#1058)tracing-core to 0.1.17 (#992)EnvFilter that contains directives that would enable a level disabled by the tracing crate's static_max_level features (#1021)Thanks to @jyn514 and @bkchr for contributing to this release!
Option<Level> lost its Into<LevelFilter> impl (#966)EnvFilter enabling spans that should not be enabled when multiple subscribers are in use (#927)format::Json now outputs fields in a more readable order (#892)tracing-core dependency to 0.1.16BoxMakeWriter for erasing the type of a MakeWriter implementation (#958)TestWriter MakeWriter implementation to support libtest output capturing (#938)Layer impl for Option<T> where T: Layer (#910)From<Level> impl for Directive (#918)Thanks to @Pothulapati, @samrg472, @bryanburgers, @keetonian, and @SriRamanujam for contributing to this release!
regex dependency enables fewer unused feature flags (#899)Thanks to @bdonlan and @jeromegn for contributing to this release!
LevelFilter is now a re-export of the tracing_core::LevelFilter type, it can now be used interchangeably with the versions in tracing and tracing-core (#853)LevelFilters and Levels (#853)tracing-core dependency to 0.1.12 (#853)LevelFilter and EnvFilter now participate in tracing-core's max level hinting, improving performance significantly in some use cases where levels are disabled globally (#853)chrono feature is disabled (#844)layer::Context are now also provided by FmtContext (#834)chrono dependency is enabled, the SystemTime timestamp formatter now emits human-readable timestamps rather than using SystemTime's fmt::Debugimplementation (chrono is still required for customized timestamp formatting) (#807)ansi_term dependency to 0.12 (#816)with_span_list method to configure the JSON formatter to include a list of all spans in the current trace in formatting events (similarly to the text formatter) (#741)with_current_span method to configure the JSON formatter to include a field for the current span (the leaf of the trace) in formatted events (#741)with_thread_names and with_thread_ids methods to configure fmt::Subscribers and fmt::Layers to include the thread name and/or thread ID of the current thread when formatting events (#818)Thanks to new contributors @mockersf, @keetonian, and @Pothulapati for contributing to this release!
parking_lot dependency to accept the latest parking_lot version (#774)Thanks to @rkuhn, @greenwoodcm, and @Ralith for contributing to this release!
Span::record would result in malformed spans (#709)ChronoUtc format_time (#677)This release includes several API ergonomics improvements, including shorthand constructors for many types, and an extension trait for initializing subscribers using method-chaining style. Additionally, several bugs in less commonly used fmt APIs were fixed.
fmt (including tracing_subscriber::fmt() to return a SubscriberBuilder, tracing_subscriber::fmt::layer() to return a format Layer, etc) (#660)tracing_subscriber::registry() to construct a new registry (#660)SubscriberInitExt extension trait for more ergonomic subscriber initialization (#660)LayerBuilder methods to Layer (#655)LayerBuilder, as Layer now implements all builder methods (#655)Compact formatter not omitting levels with with_level(false) (#657)fmt::Layer duplicating the fields for a new span if another layer has already formatted its fields (#634)record to add new fields to a span that already has fields (#659)flatten_event to SubscriberBuilder (#599)with_level to SubscriberBuilder (#594)EnvFilter directive selection now behaves correctly (i.e. like env_logger) (#583)EnvFilter incorrectly allowing less-specific filter directives to enable events that are disabled by more-specific filters (#583)EnvFilter performance improvements, especially when filtering events generated by log records (#578, #583)BTreeMap with Vec in DirectiveSet, improving iteration performance significantly with typical numbers of filter directives (#580)A big thank-you to @samschlegel for lots of help with EnvFilter performance tuning in this release!
Context to FmtContext (#420, #425)Builder to SubscriberBuilder (#420)Filter. Use EnvFilter instead (#434)Registry, a Subscriber implementation that Layers can use as a high-performance, in-memory span store. (#420, #425, #432, #433, #435)LookupSpan trait, implemented by Subscribers to expose stored span data to Layers (#420)fmt::Layer, to allow composing log formatting with other LayersContext to FmtContext (#420, #425) (BREAKING)Builder to SubscriberBuilder (#420) (BREAKING)fmt::Subscriber in terms of the Registry and Layers (#420)Filter. Use EnvFilter instead (#434) (BREAKING)fmt::SubscriberBuilder::init not setting up log compatibility (#489)Layered subscribers failing to downcast to their own type (#549)Layer::downcast_ref returning invalid references (#454){} printed after spans with no fields (f079f2d)smallvec dependency to 0.1 (#543)Layered subscribers failing to downcast to their own type (#549)FormattedFields extensions from the same formatter type (1c3bb70)fmt::Layer::on_record inserting a new FormattedFields when formatted fields for a span already exist (1c3bb70)dbg! macros (#533)FormattedFields::new constructor (#478)fmt::Layer documentation (#510)with_target(false) (#481)fmt::SubscriberBuilder::init not setting up log compatibility (#489)no-default-features (#499, #500)LookupSpans implementation for Layered (#448)SpanRef::from_root to iterate over a span's parents from the root (#460)Context::scope, to iterate over the current context from the root (#460)Context::lookup_current, which returns a SpanRef to the current span's data (#460)Context methods to be less restrictive (#460)Layer::downcast_ref returning invalid references (#454)Registry, a reusable span store that Layers can use a high-performance, in-memory store. (#420, #425, #432, #433, #435)fmt::Subscriber in terms of the Registry and Layers (#420)fmt::format::FormatFields and fmt::format::FormatEvent to accept a mandatory FmtContext. These FormatFields and FormatEvent will likely see additional breaking changes in subsequent alpha. (#420, #425)Filter. Use EnvFilter instead (#434)Thanks to all the contributors to this release!
init and try_init functions to FmtSubscriber (#385)ChronoUtc and ChronoLocal timers, RFC 3339 support (#387)tracing::subscriber::set_default which sets the default subscriber and returns a drop guard. This drop guard will reset the dispatch on drop (#388).EnvFilter. Setting RUST_LOG=target previously only the ERROR level, while it should enable everything. tracing-subscriber now defaults to TRACE if no level is specified (#401)tracing-log feature flag for init + try_init. The feature flag tracing_log was used instead of the correct tracing-log. As a result, both tracing-log and tracing_log needed to be specified in order to initialize the global logger. Only tracing-log needs to be specified now (#400).Thanks to all the contributors to this release!
FmtSubscriber::current_span is used (#371)with_ansi(false) on FmtSubscriber not disabling ANSI color formatting for timestamps (#354)FmtSubscriber that could cause spans to not be closed when all references are dropped (#366)Layered subscribers not properly forwarding calls to current_span (#350)EnvFilter ignoring directives with targets that are the same number of characters (#333)EnvFilter failing to properly apply filter directives to events generated from log records bytracing-log (#344)Filter to EnvFilter, deprecated Filter (#339)FmtSubscriber now defaults to enabling only the INFO level and above when a max level filter or EnvFilter is not set (#336)parking_lot dependency an opt-in feature flag (#348)EnvFilter::add_directive to add new directives to filters after they are constructed (#334)fmt::Builder::with_max_level to set a global level filter for a FmtSubscriber without requiring the use of EnvFilter (#336)Layer implementation for LevelFilter (#336)EnvFilter now implements fmt::Display (#329)crossbeam-util (#348)CurrentSpan (#325)