1 // Copyright 2013-2014 The Rust Project Developers.
2 // Copyright 2018 The Uuid Project Developers.
3 //
4 // See the COPYRIGHT file at the top-level directory of this distribution.
5 //
6 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9 // option. This file may not be copied, modified, or distributed
10 // except according to those terms.
11 
12 use crate::prelude::*;
13 use slog;
14 
15 impl slog::Value for Uuid {
serialize( &self, _: &slog::Record<'_>, key: slog::Key, serializer: &mut dyn slog::Serializer, ) -> Result<(), slog::Error>16     fn serialize(
17         &self,
18         _: &slog::Record<'_>,
19         key: slog::Key,
20         serializer: &mut dyn slog::Serializer,
21     ) -> Result<(), slog::Error> {
22         serializer.emit_arguments(key, &format_args!("{}", self))
23     }
24 }
25 
26 #[cfg(test)]
27 mod tests {
28 
29     #[test]
test_slog_kv()30     fn test_slog_kv() {
31         use crate::test_util;
32         use slog;
33         use slog::{crit, Drain};
34 
35         let root = slog::Logger::root(slog::Discard.fuse(), slog::o!());
36         let u1 = test_util::new();
37         crit!(root, "test"; "u1" => u1);
38     }
39 }
40