Skip to content

Erlang port driver for interacting with syslog via syslog(3)

Notifications You must be signed in to change notification settings

elli-lib/erlang-syslog

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Erlang port driver for interacting with syslog via syslog(3)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Erlang 66.3%
  • C 33.7%