rfc5424/rfc5424.rs
1extern crate syslog;
2
3use std::collections::BTreeMap;
4use syslog::{Facility, Formatter5424};
5
6fn main() {
7 let formatter = Formatter5424 {
8 facility: Facility::LOG_USER,
9 hostname: None,
10 process: "myprogram".into(),
11 pid: 0,
12 };
13
14 match syslog::unix(formatter) {
15 Err(e) => println!("impossible to connect to syslog: {:?}", e),
16 Ok(mut writer) => {
17 writer
18 .err((1, BTreeMap::new(), "hello world"))
19 .expect("could not write error message");
20 }
21 }
22}