From 8f11e8d9c027a322b8cd749764cb8a3e3e352b03 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 24 Sep 2022 19:29:37 +0100 Subject: [PATCH] syslog: printing level in messages Signed-off-by: Ian Jackson --- Cargo.lock | 13 ++++++++++--- Cargo.toml | 1 + src/reporter.rs | 4 +++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d2a14c2..ace1cf0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -203,9 +203,9 @@ dependencies = [ [[package]] name = "eyre" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "221239d1d5ea86bf5d6f91c9d6bc3646ffe471b08ff9b0f91c44f115ac969d2b" +checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" dependencies = [ "indenter", "once_cell", @@ -407,6 +407,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -428,6 +434,7 @@ dependencies = [ "eyre", "fehler", "futures", + "heck 0.4.0", "hippotat-macros", "hyper", "hyper-tls", @@ -1095,7 +1102,7 @@ version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7813934aecf5f51a54775e00068c237de98489463968231a51746bbbc03f9c10" dependencies = [ - "heck", + "heck 0.3.3", "proc-macro-error", "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 2d6289b..e3e1060 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ backtrace = "0.3" base64 = "0.13" env_logger = "0.9" futures = "0.3" +heck = "0.4" hyper = { version = "0.14", features = ["full"] } hyper-tls = "0.5" ipnet = "2" diff --git a/src/reporter.rs b/src/reporter.rs index 4343c8d..148b5e7 100644 --- a/src/reporter.rs +++ b/src/reporter.rs @@ -67,7 +67,9 @@ impl log::Log for LogWrapper where T: log::Log { copy!{ level, target, module_path, file, line }; - match format_args!("{}", record.args()) { + match format_args!("{}: {}", + heck::AsKebabCase(record.level().as_str()), + record.args()) { args => { wrap.args(args); self.output.log(&wrap.build()); -- 2.30.2