File:  [CSRG BSD Unix] / 42BSD / usr.lib / sendmail / aux / syslog.3
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:54 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD42
BSD 4.2

.TH syslog 3
.SH NAME
syslog, openlog, closelog -- control system log
.SH SYNOPSIS
# include <syslog.h>
.PP
openlog(ident, logstat)
.br
char *ident;
.PP
syslog(priority, message, parameters ... )
.br
char *message;
.PP
closelog()
.SH DESCRIPTION
.I Syslog
writes the
.I message
to the program syslog(8)
The message is tagged with priority
.I priority.
The message looks like a
.I printf(3)
string except that
.B %m
is replaced by the current error message
(collected from
.I errno\c
).
A trailing newline is added if needed.
This message will be read by
.I syslog(8)
and output to the system console or files as appropriate.
.PP
If special processing is needed,
.I openlog
can be called to initialize the log file.
Parameters are
.I ident
which is a string prepended to every message,
and
.I logstat
a bit field indicating special status;
current values are:
.IP LOG_PID \w'LOG_PID'u+3
log the process id with each message:
useful for identifying instantiations of daemons.
.LP
.I Openlog
returns zero if it could create the socket.
Otherwise, it arranges to write on /dev/console
and returns -1.
Calls to
.I syslog
can still proceed,
but any message with priority under
.I LogMask (normally
.BR LOG_CRIT )
will be thrown away.
.PP
.I Closelog
can be used to close the log socket.
.SH EXAMPLES
.nf
syslog(LOG_SALERT, "who: internal error 23");
.PP
openlog("serverftp", LOG_PID);
syslog(LOG_INFO, "Connection from host %d", CallingHost);
.fi
.SH SEE\ ALSO
syslog(8)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.