Skip to content

Commit 6665d51

Browse files
committed
Upgrade to slog v2.8
Implement Drain::flush and enable the `nested-values` feature by default.
1 parent 4da814f commit 6665d51

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
8+
### Changed
9+
* Upgrade to [slog v2.8.0].
10+
* Enable `nested-values` feature by default
11+
* Increase MSRV to 1.61 (same as slog)
12+
13+
### Added
14+
* Implement `Drain::flush` (new in [slog v2.8.0])
15+
16+
[slog v2.8.0]: https://github.com/slog-rs/slog/releases/v2.8.0
817

918
## 2.6.0 - 2022-02-20
1019
### Changed

Cargo.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,23 @@ readme = "README.md"
1515
# Please do not bump this unnecessarily.
1616
# Changing this should bump the minor version for semver (2.x for semver).
1717
#
18-
# The first version of Cargo that supports this field was in Rust 1.56.0.
19-
# In older releases, the field will be ignored, and Cargo will display a warning.
20-
rust-version = "1.53"
18+
# This currently matches the MSRV of slog
19+
rust-version = "1.61"
2120

2221
[features]
23-
nested-values = ["erased-serde", "slog/nested-values"]
22+
default = ["nested-values"]
23+
nested-values = ["dep:erased-serde", "slog/nested-values"]
2424
dynamic-keys = ["slog/dynamic-keys"]
25-
default = []
2625

2726
[dependencies]
28-
slog = { version = "2.1.1" }
27+
slog = "2.8"
2928
serde_json = "1"
3029
serde = "1"
31-
erased-serde = {version = "0.3", optional = true }
30+
erased-serde = { version = "0.4", optional = true }
3231
time = { version = "0.3.6", features = ["formatting"] }
3332

3433
[dev-dependencies]
3534
slog-async = "2"
3635

3736
[package.metadata.docs.rs]
38-
features = ["nested-values", "dynamic-keys"]
37+
features = ["dynamic-keys"]

src/lib.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
extern crate slog;
2424

2525
use serde::ser::SerializeMap;
26-
use serde::serde_if_integer128;
2726
use slog::Key;
2827
use slog::Record;
2928
use slog::{FnValue, PushFnValue};
@@ -132,13 +131,11 @@ where
132131
fn emit_f64(&mut self, key: Key, val: f64) -> slog::Result {
133132
impl_m!(self, key, &val)
134133
}
135-
serde_if_integer128! {
136-
fn emit_u128(&mut self, key: Key, val: u128) -> slog::Result {
137-
impl_m!(self, key, &val)
138-
}
139-
fn emit_i128(&mut self, key: Key, val: i128) -> slog::Result {
140-
impl_m!(self, key, &val)
141-
}
134+
fn emit_u128(&mut self, key: Key, val: u128) -> slog::Result {
135+
impl_m!(self, key, &val)
136+
}
137+
fn emit_i128(&mut self, key: Key, val: i128) -> slog::Result {
138+
impl_m!(self, key, &val)
142139
}
143140
fn emit_str(&mut self, key: Key, val: &str) -> slog::Result {
144141
impl_m!(self, key, &val)
@@ -193,7 +190,7 @@ where
193190
}
194191

195192
/// Build custom `Json` `Drain`
196-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::new_ret_no_self))]
193+
#[allow(clippy::new_ret_no_self)]
197194
pub fn new(io: W) -> JsonBuilder<W> {
198195
JsonBuilder::new(io)
199196
}
@@ -254,6 +251,11 @@ where
254251
}
255252
Ok(())
256253
}
254+
255+
fn flush(&self) -> Result<(), slog::FlushError> {
256+
let mut io = self.io.borrow_mut();
257+
io.flush().map_err(slog::FlushError::from)
258+
}
257259
}
258260

259261
// }}}

0 commit comments

Comments
 (0)