dummy-link

Syslogs

Julia syslog interface

Readme

Syslogs

stable latest CI codecov

Installation

Pkg.clone("https://github.com/invenia/Syslogs.jl")

Usage

Syslogs.jl defines and exports a Syslog type which is a subtype of IO.

# Create our Syslog IO type which logs to the local syslog daemon via the libc interface.
io = Syslog()

# Print a log message to syslog of the form "\0".
println(io, :info, "Hello World!")

To log to a remote server you can pass the remote ip address and port to the Syslog constructor.

# Create our Syslog IO type which logs to a remote syslog service with the specified `ipaddr` and `port` via TCP.
io = Syslog(ipaddr, port; tcp=true)

# `log` is just and alias for `println` in this case.
log(io, :info, "Hello World!")

Several IO methods exist for the Syslog type:

println(io::Syslogs.Syslog, level::Symbol, msg::String)
println(io::Syslogs.Syslog, level::AbstractString, msg::AbstractString)
log(io::Syslogs.Syslog, args...)
close(io::Syslogs.Syslog)
flush(io::Syslogs.Syslog)

Syslogs.jl also provides several methods to the libc interface:

Syslogs.openlog(ident::String, logopt::Integer, facility::Integer)
Syslogs.syslog(priority::Integer, msg::String)
Syslogs.closelog()
Syslogs.makepri(facility::Integer, priority::Integer)   # maps to the LOG_MAKEPRI macro

TODO

  • TLS support with MbedTLS.jl

First Commit

11/26/2017

Last Touched

about 1 month ago

Commits

42 commits

Requires: