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