Releases: slog-rs/slog
Fix private field breaking `#` operator in macros
Fixes issue #364
Release Notes
Fixed
- Fix use of
#operator in macros due to private field (issue #364)- Thanks to @Manishearth for identifying this.
- ci: Check the tests pass with
-Zminimal-versions
Move back to erased_serde v0.3
The upgrade from erased_serde v0.3 to v0.4 in v2.8.0 was a breaking change, as it affected the public API. In the future, we may find a way to upgrade in a backwards-compatible manner. This should not affect normal users of the API but could break drains supporting nested-values.
I (@Techcable) apologize for this breakage and have yanked the 2.8.0 release due to this issue. I will try to setup cargo-semver-checks in the CI to avoid this in the future.
Fixed
- Restore compatibility with
erased-serdeversion0.3. - Ensure compatibility with
-Zminimal-versionsflag by specifying minimal dependency versions (fixes #357)
Enable nested-values feature by default
This is the biggest slog release since v2.0! It contains many smaller fixes and improvements to slog that have been accumulated across 5 years and 127 commits.
The nested-values feature was already present in slog, and allows logging serde::Serialize types in addition to primitives. Previously, the nested-values feature had to be enabled not just in slog but also in each drain crate (slog_json, slog_term, slog_async, etc). Enabling this feature by default makes the crate easier to use and avoids several papercts. It should have no runtime overhead if not used and low compile-time overhead thanks to the new serde_core crate.
Another major feature is Logger::flush, which explicitly flushes buffered log messages. The next major release of slog_json, slog_async, etc., will also include support for this feature, in addition to enabling nested-values by default.
Changelog
The following has been copied from CHANGELOG.md
Highlights
- Enables the
nested-valuesfeature by default.
The next major release ofslog_json,slog_term, etc should also enable this feature by default. - Added
Logger::flushandDrain::flushmethods. - Improved support for logging errors
- Have
#log specifier transparently support&references to error - Implement
slog::ValueforBox<dyn std::error::Error>andanyhow::Error
- Have
- Define a
preludemodule for common imports - Upgraded to Rust 2018 and require Rust 1.61
- Deprecate the old
slog_log!macros in favor ofslog::log!
- Deprecate the old
- Many internal improvements & bug fixes
Changed
- Enables the
nested-valuesfeature by default. - Updated to Rust 2018
- NOTE: Old 2015 crates will still work because of excellent 2015/2018 compatibility
- Bump MSRV to 1.61
- This is already required for
erased-serde,syn,serde_core, and many other important crates in the rust ecosystem.
- This is already required for
- Update
erased-serdefrom v0.3 to v0.4 - Depend on
serde_corerather thanserdeto reduce compile times.
Added
- Added a
Logger::flushandDrain::flushmethods- Since this is a new method, not all drains implement it.
Calling it on an unsupported drain will give an error
- Since this is a new method, not all drains implement it.
- Define a
preludemodule for common imports.
Replaceuse slog::{Serde, Logger, info, debug, trace}withuse slog::prelude::* - Optionally implement Drain for
parking_lot::Mutex.
This is noticeably faster thanstd::sync::Mutex, is smaller, and avoids poisoning.- This feature has a separate name per version to allow supporting multiple versions of
parking_lotat once. The current version (v0.12) has feature nameparking_lot_0_12
- This feature has a separate name per version to allow supporting multiple versions of
- Implement slog::Value for
dyn std::error::ErrorandBox<dyn std::error:Error(along with theSend/Syncversions). - Optionally implement slog::Value for
anyhow::Error(requiresanyhowfeature) - Add
ErrorRefwrapper to enable logging error references (PR #327)- The
#error formatter in macros was updated to automatically selectErrorValueorErrorRef(PR #328)
- The
- Add
emit_bytesmethod (PR #290)- Control formatting using
BytesKindenum
- Control formatting using
- Implement
Valueforstd::borrow::Cow
Deprecated
- Deprecate old prefixed macros like
slog_log.
Rust 2018 macro paths likeslog::log!make these unnecessary.
Fixed
- Fix logging of references to errors (resolved by introduction of
ErrorRefin PR #327) - Take advantage of the fact that in 1.81
std::error::Errorhas been moved tocore.
On this rust version, slog now supports the error trait without requiringstd. - Add
#[must_use]to most public types, includingslog::Logger,slog::OwnedKV, andslog::FnValue. - Give a descriptive error when the
nested-valuesfeature is unsupported. - Alias the
slog::Nevertype tostd::convert::Infallible, fixing issue #209. - doc: Fix typo in slog::Value docs (issue #335)
- Thank you to @larswirzenius for noticing this!
- doc: Fix "lazy continuation" in
slog::Loggerdoc- This mistake was caught by a new lint
#[warn(clippy::doc_lazy_continuation)]
- This mistake was caught by a new lint
- Fix some internal warnings
- Example: Avoid the new
#[warn(unexpected_cfgs)]lint. - The crate almost passes clippy::pedantic now, except for a few very verbose lints like
clippy::must-use-candidate - None of these changes should affect user crates
- Example: Avoid the new
- Stop requiring the
serde_derivecrate to implement thenested-valuesfeature.
We depend on the newserde_coreinstead of even requiringserde. - The
nested-valuesfeature no longer requiresserde/std(was a mistake). - Always support 128-bit integers, even on the
wasm32-unknown-emscriptentarget. - Fix support for
feature="nothreads"- Internal refactoring to make different feature combos much easier (PR #301)
- Switch from Travis CI to Github Actions (fixes #294)
rustfmt --checknow run by default- Require
clippyto succeed without warnings - Require all feature combinations to pass tests.
- Make exception for
nested-valuesfeature on MSRV (1.49),
becauseerased-serdedependency requiresedition="2021"(needs 1.56)
- Make exception for
- Fix
#format when not used as a last argument. - Fix duplicate
AsRef<str>implementations when usingdynamic-keysfeature. - Fix incorrect 'long' name for
slog::Level::Warning(fixes issue #282)