Enable nested-values feature by default #356
Techcable
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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-valuesfeature was already present in slog, and allows loggingserde::Serializetypes in addition to primitives. Previously, thenested-valuesfeature 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 newserde_corecrate.Another major feature is
Logger::flush, which explicitly flushes buffered log messages. The next major release ofslog_json,slog_async, etc., will also include support for this feature, in addition to enablingnested-valuesby default.Changelog
The following has been copied from
CHANGELOG.mdHighlights
nested-valuesfeature by default.The next major release of
slog_json,slog_term, etc should also enable this feature by default.Logger::flushandDrain::flushmethods.#log specifier transparently support&references to errorslog::ValueforBox<dyn std::error::Error>andanyhow::Errorpreludemodule for common importsslog_log!macros in favor ofslog::log!Changed
nested-valuesfeature by default.erased-serde,syn,serde_core, and many other important crates in the rust ecosystem.erased-serdefrom v0.3 to v0.4serde_corerather thanserdeto reduce compile times.Added
Logger::flushandDrain::flushmethodsCalling it on an unsupported drain will give an error
preludemodule for common imports.Replace
use slog::{Serde, Logger, info, debug, trace}withuse slog::prelude::*parking_lot::Mutex.This is noticeably faster than
std::sync::Mutex, is smaller, and avoids poisoning.parking_lotat once. The current version (v0.12) has feature nameparking_lot_0_12dyn std::error::ErrorandBox<dyn std::error:Error(along with theSend/Syncversions).anyhow::Error(requiresanyhowfeature)ErrorRefwrapper to enable logging error references (PR AddErrorRefwrapper #327)#error formatter in macros was updated to automatically selectErrorValueorErrorRef(PR SupportErrorRefin#error formatter #328)emit_bytesmethod (PR [Merged] Addemit_bytesmethod. #290)BytesKindenumValueforstd::borrow::CowDeprecated
slog_log.Rust 2018 macro paths like
slog::log!make these unnecessary.Fixed
ErrorRefin PR AddErrorRefwrapper #327)std::error::Errorhas been moved tocore.On this rust version, slog now supports the error trait without requiring
std.#[must_use]to most public types, includingslog::Logger,slog::OwnedKV, andslog::FnValue.nested-valuesfeature is unsupported.slog::Nevertype tostd::convert::Infallible, fixing issue Change slog::Never to a typedef of std::convert::Infallible #209.slog::Loggerdoc#[warn(clippy::doc_lazy_continuation)]#[warn(unexpected_cfgs)]lint.clippy::must-use-candidateserde_derivecrate to implement thenested-valuesfeature.We depend on the new
serde_coreinstead of even requiringserde.nested-valuesfeature no longer requiresserde/std(was a mistake).wasm32-unknown-emscriptentarget.feature="nothreads"rustfmt --checknow run by defaultclippyto succeed without warningsnested-valuesfeature on MSRV (1.49),because
erased-serdedependency requiresedition="2021"(needs 1.56)#format when not used as a last argument.AsRef<str>implementations when usingdynamic-keysfeature.slog::Level::Warning(fixes issue Unconsistent slog::Level conversion to string on Warning variation #282)This discussion was created from the release Enable nested-values feature by default.
Beta Was this translation helpful? Give feedback.
All reactions