Syslogs.jl

Julia syslog interface
Author invenia
Popularity
2 Stars
Updated Last
3 Years Ago
Started In
November 2017

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 "<pri><msg>\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

Required Packages

No packages found.

Used By Packages