slog_loggly/error.rs
1use std::fmt::{Display, Formatter};
2
3/// Error.
4#[derive(Debug, Clone)]
5pub struct Error {
6 msg: String,
7}
8
9impl Error {
10 /// Create a new error with a given message.
11 pub fn new<T>(msg: T) -> Self
12 where
13 T: ToString,
14 {
15 Self {
16 msg: msg.to_string(),
17 }
18 }
19}
20
21impl std::error::Error for Error {}
22
23impl Display for Error {
24 fn fmt(&self, f: &mut Formatter) -> Result<(), std::fmt::Error> {
25 f.write_str(&self.msg)
26 }
27}