Skip to content

Commit 0e9656a

Browse files
Rework for syslog version 5. This is a breaking change.
The `syslog` crate underwent extensive API refactoring between versions 3 and 5. This commit rewrites much of `slog-syslog` to fit the new API. It is partially compatible with previous versions of `slog-syslog` (`examples/syslog-unix.rs` still works without modification), but the shape of `Streamer3164` in particular is quite different. There are also some new features: * All `SyslogBuilder` settings are now optional and have sensible defaults. Simply running `SyslogBuilder::new().start()` will yield a usable `Drain` (if there is a syslog daemon on the local machine). * `SyslogBuilder` no longer requires a hostname to be supplied when choosing a transport (TCP, UDP, Unix socket). Instead, the hostname is a separate setting (`SyslogBuilder::hostname`), and if none is provided, it's discovered (if possible) using the `hostname` crate. * `Streamer3164` no longer contains a mutex, and is not thread-safe (that is, it is no longer `Sync`). This improves performance when used with slog-async, which doesn't need the underlying `Drain` to be thread-safe. `slog::Logger` does require the underlying `Drain` to be thread-safe, so `SyslogBuilder::start` now returns a `Streamer3164` wrapped in a `Mutex`, and there's now a `SyslogBuilder::start_single_threaded` method that returns an unwrapped `Streamer3164` instead. * Key-value pairs attached to logging records are now, by default, formatted in a style that resembles RFC 5424 STRUCTURED-DATA. Their formatting can be customized by implementing the `MsgFormat3164` trait.
1 parent 6327dd4 commit 0e9656a

File tree

3 files changed

+738
-144
lines changed

3 files changed

+738
-144
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "slog-syslog"
3-
version = "0.12.0"
3+
version = "0.13.0"
44
authors = ["Dawid Ciężarkiewicz <dpc@dpc.pw>", "William Laeder <codylaeder@gmail.com" ]
55
description = "Syslog drain for slog-rs"
66
keywords = ["slog", "logging", "json", "log", "syslog"]
@@ -14,6 +14,6 @@ readme = "README.md"
1414
path = "lib.rs"
1515

1616
[dependencies]
17+
hostname = "0.3"
1718
slog = "^2.1.1"
18-
syslog = "3.3.0"
19-
nix = "0.14.0"
19+
syslog = "5.0.0"

0 commit comments

Comments
 (0)