syslog.pl -- Unix syslog interface
This library provides an interface to the Unix syslog()
facility. The
interface is an almost direct translation of the POSIX syslog API, with
two additions:
- syslog/3 exploits format/3 to format syslog messages
- The library integrates into library(debug) using
prolog:debug_print_hook/3, where debug topics are mapped to
syslog priorities and remaining debug topics are mapped
to the syslog priority
debug
.
Note that this interface makes no attempt to abstract over logging facilities of operating systems. We expect that such abstractions will be implemented at the Prolog level using multiple integrations into library(debug).
- openlog(+Ident:atom, +Options:list(atom), +Facility:atom) is det
- Open system log. This predicate provides a direct interface into
the
openlog()
library call. If the library call is successful, it runsat_halt(closelog)
to ensure closing the system log on clean exit. - syslog(+Priority, +Message) is det
- Send a message to the system log. Note that syslog/2 implicitly opens a connection to the system log if such a connection has not been opened explicitly using openlog/3.
- syslog(+Priority, +Format, +Args) is det
- Send a formatted message to the system log if system logging is opened using openlog/3. This predicate combined format/3 with syslog/2. If there is no open syslog connection, syslog/3 calls print_message/2.
- closelog is det
- Close the system log.
- prolog:debug_print_hook(+Topic, +Format, +Args) is semidet[multifile]
- Integration of debug/3 with the syslog facility. If syslog is
enabled, debug/3 is re-routed to use the syslog facilities. If
the topic of the debug message matches one of the sylog
priority values (see syslog/2), the message is sent with the
corresponding syslog priority. Otherwise it it sent with the
debug
priority.