syslog 2.1.0

Send log messages to syslog
Documentation

Sending to Syslog in Rust

Build Status Coverage Status

A small library to write to local syslog.

Installation

syslog is available on crates.io and can be included in your Cargo enabled project like this:

[dependencies]
syslog = "~2.1.0"

documentation

Reference documentation is available here.

Example

extern crate syslog;

use syslog::{Facility,Severity};

fn main() {
  match syslog::unix(Facility::LOG_USER) {
    Err(e)         => println!("impossible to connect to syslog: {:?}", e),
    Ok(writer) => {
      let r = writer.send(Severity::LOG_ALERT, String::from("hello world"));
      if r.is_err() {
        println!("error sending the log {}", r.err().expect("got error"));
      }
    }
  }
}

The struct syslog::Logger implements Log from the log crate, so it can be used as backend for other logging systems.