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
use std::string::String;
use std::str::FromStr;
use chrono::DateTime;
use chrono::offset::FixedOffset;
use severity::Severity;
use parser::{ParseError, parse_message};
#[derive(Clone, Debug)]
pub struct Message {
pub severity: Severity,
pub timestamp: Option<DateTime<FixedOffset>>,
pub hostname: Option<String>,
pub appname: Option<String>,
pub procid: Option<String>,
pub msgid: Option<String>,
pub msg: String,
}
impl FromStr for Message {
type Err = ParseError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
parse_message(s)
}
}