syslog 3.3.0

Send log messages to syslog

Sending to Syslog in Rust

Build Status Coverage Status

A small library to write to local syslog.


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

syslog = "~3.3.0"


Reference documentation is available here.


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_3164(Severity::LOG_ALERT, "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.

There are 3 functions to create loggers:

  • the unix function sends to the local syslog through a Unix socket: syslog::unix(Facility::LOG_USER)
  • the tcp function takes an address for a remote TCP syslog server and a hostname: tcp("", "localhost".to_string(), Facility::LOG_USER)
  • the udp function takes an address for a local port, and the address remote UDP syslog server and a hostname: udp("", "", "localhost".to_string(), Facility::LOG_USER)