From 5363f350887b1e5b5dd21a86f88c8af9d7fea6da Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:25 +0200 Subject: Merging upstream version 1.67.1+dfsg1. Signed-off-by: Daniel Baumann --- vendor/uuid/src/slog_support.rs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 vendor/uuid/src/slog_support.rs (limited to 'vendor/uuid/src/slog_support.rs') diff --git a/vendor/uuid/src/slog_support.rs b/vendor/uuid/src/slog_support.rs new file mode 100644 index 000000000..472b39aba --- /dev/null +++ b/vendor/uuid/src/slog_support.rs @@ -0,0 +1,39 @@ +// Copyright 2013-2014 The Rust Project Developers. +// Copyright 2018 The Uuid Project Developers. +// +// See the COPYRIGHT file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use crate::prelude::*; +use slog; + +impl slog::Value for Uuid { + fn serialize( + &self, + _: &slog::Record<'_>, + key: slog::Key, + serializer: &mut dyn slog::Serializer, + ) -> Result<(), slog::Error> { + serializer.emit_arguments(key, &format_args!("{}", self)) + } +} + +#[cfg(test)] +mod tests { + + #[test] + fn test_slog_kv() { + use crate::test_util; + use slog; + use slog::{crit, Drain}; + + let root = slog::Logger::root(slog::Discard.fuse(), slog::o!()); + let u1 = test_util::new(); + crit!(root, "test"; "u1" => u1); + } +} -- cgit v1.2.3