Sending to Syslog in Rust
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:
[]
= "~3.3.0"
documentation
Reference documentation is available here.
Example
extern crate syslog;
use ;
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
unixfunction sends to the local syslog through a Unix socket:syslog::unix(Facility::LOG_USER) - the
tcpfunction takes an address for a remote TCP syslog server and a hostname:tcp("127.0.0.1:4242", "localhost".to_string(), Facility::LOG_USER) - the
udpfunction takes an address for a local port, and the address remote UDP syslog server and a hostname:udp("127.0.0.1:1234", "127.0.0.1:4242", "localhost".to_string(), Facility::LOG_USER)