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-serde
version0.3
. - Ensure compatibility with
-Zminimal-versions
flag 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-values
feature by default.
The next major release ofslog_json
,slog_term
, etc should also enable this feature by default. - Added
Logger::flush
andDrain::flush
methods. - Improved support for logging errors
- Have
#
log specifier transparently support&
references to error - Implement
slog::Value
forBox<dyn std::error::Error>
andanyhow::Error
- Have
- Define a
prelude
module 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-values
feature 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-serde
from v0.3 to v0.4 - Depend on
serde_core
rather thanserde
to reduce compile times.
Added
- Added a
Logger::flush
andDrain::flush
methods- 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
prelude
module 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_lot
at 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::Error
andBox<dyn std::error:Error
(along with theSend
/Sync
versions). - Optionally implement slog::Value for
anyhow::Error
(requiresanyhow
feature) - Add
ErrorRef
wrapper to enable logging error references (PR #327)- The
#
error formatter in macros was updated to automatically selectErrorValue
orErrorRef
(PR #328)
- The
- Add
emit_bytes
method (PR #290)- Control formatting using
BytesKind
enum
- Control formatting using
- Implement
Value
forstd::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
ErrorRef
in PR #327) - Take advantage of the fact that in 1.81
std::error::Error
has 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-values
feature is unsupported. - Alias the
slog::Never
type 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::Logger
doc- 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_derive
crate to implement thenested-values
feature.
We depend on the newserde_core
instead of even requiringserde
. - The
nested-values
feature no longer requiresserde/std
(was a mistake). - Always support 128-bit integers, even on the
wasm32-unknown-emscripten
target. - 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 --check
now run by default- Require
clippy
to succeed without warnings - Require all feature combinations to pass tests.
- Make exception for
nested-values
feature on MSRV (1.49),
becauseerased-serde
dependency requiresedition="2021"
(needs 1.56)
- Make exception for
- Fix
#
format when not used as a last argument. - Fix duplicate
AsRef<str>
implementations when usingdynamic-keys
feature. - Fix incorrect 'long' name for
slog::Level::Warning
(fixes issue #282)