1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use super::logger::RecordInfo;

use super::OwnedKeyValueNode;

use std::io;

#[allow(missing_docs)]
mod error {
    use std::io;
    use super::super::ser;

    error_chain! {
        types {
            Error, ErrorKind, ChainErr, Result;
        }
        links {
            ser::Error, ser::ErrorKind, Serialization;
        }
        foreign_links {
            io::Error, Io, "io error";
        }
        errors {}
    }
}

pub use self::error::{Error, Result, ErrorKind};

/// Format record information
pub trait Format: Send + Sync + Sized {
    /// Format one logging record and write into `io`
    fn format(&self,
              io: &mut io::Write,
              info: &RecordInfo,
              logger_values: &OwnedKeyValueNode)
              -> Result<()>;
}