Skip to content

Latest commit

 

History

History
79 lines (54 loc) · 1.81 KB

README.md

File metadata and controls

79 lines (54 loc) · 1.81 KB

Erlang driver for syslog

Build Status

This is an Erlang port driver for interacting with syslog.

Building

rebar3 compile

Usage

You should have a look at syslog.h.

In another shell:

tail -f /var/log/syslog

Or, for mac users:

tail -f /var/log/system.log

In an Erlang shell:

> syslog:start().
> {ok,Log} = syslog:open("Beuha", [cons, perror, pid], local0).
> syslog:log(Log, err, "Damned").
> syslog:log(Log, info, "process count: ~w", [length(processes())]).

API

-type openlog_opt() :: pid | cons | odelay | ndelay | perror | pos_integer().

-type facility() :: kern    | user       | mail     | daemon
                  | auth    | syslog     | lpr      | news
                  | uucp    | cron       | authpriv | ftp
                  | netinfo | remoteauth | install  | ras
                  | local0  | local1     | local2   | local3
                  | local4  | local5     | local6   | local7
                  | non_neg_integer().

-type priority() :: emerg   | alert  | crit | err
                  | warning | notice | info | debug
                  | non_neg_integer().

-spec open(Ident, LogOpt, Facility) -> {ok, Log} |  {error, any()} when
      Ident    :: string(),
      LogOpt   :: openlog_opt() | [openlog_opt()],
      Facility :: facility(),
      Log      :: port().

-spec log(Log :: port(), Priority :: priority(), Message :: iolist()) -> ok.

-spec log(Log, Priority, Format, Data) -> ok when
      Log      :: port(),
      Priority :: priority(),
      Format   :: io:format(),
      Data     :: [term()].

-spec close(Log :: port()) -> ok.

BUGS

  • None known