blob: 264b40b3c25dee154ed438d6bbac9e5b5da17cde [file] [log] [blame]
extern crate syslog;
use std::collections::HashMap;
use syslog::{Facility, Formatter5424};
fn main() {
let formatter = Formatter5424 {
facility: Facility::LOG_USER,
hostname: None,
process: "myprogram".into(),
pid: 0,
};
match syslog::unix(formatter) {
Err(e) => println!("impossible to connect to syslog: {:?}", e),
Ok(mut writer) => {
writer
.err((1, HashMap::new(), "hello world"))
.expect("could not write error message");
}
}
}