clogger · Section 3
clog_set_facility
NAME
clog_set_facility - change the syslog facility
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/clogger.h>
ccol_retval clog_set_facility(clog logger,
clog_syslog_facility facility);
DESCRIPTION
Sets the syslog facility that the shared backing store holds. The facility goes into the PRI field of every RFC 5424 message, as (facility * 8) + severity. The value lives on the shared store, so the change is visible to every logger handle that writes to the same file descriptor, the root logger and every derived logger. The facility matters only when the output format is CLOG_FMT_SYSLOG. Calling this with any other format does no harm: The store keeps the new value, and it reaches the output once somebody selects CLOG_FMT_SYSLOG. Available facility codes (RFC 5424 / RFC 3164): CLOG_SYSLOG_KERN (0): Kernel messages CLOG_SYSLOG_USER (1): User-level messages (default) CLOG_SYSLOG_MAIL (2): Mail system CLOG_SYSLOG_DAEMON (3): System daemons CLOG_SYSLOG_AUTH (4): Security / authorization messages CLOG_SYSLOG_SYSLOG (5): Internal syslogd messages CLOG_SYSLOG_LPR (6): Line printer subsystem CLOG_SYSLOG_NEWS (7): Network news subsystem CLOG_SYSLOG_UUCP (8): UUCP subsystem CLOG_SYSLOG_CRON (9): Clock daemon CLOG_SYSLOG_AUTHPRIV (10): Security / authorization (private) CLOG_SYSLOG_FTP (11): FTP daemon CLOG_SYSLOG_LOCAL0 (16): Local use 0 ... CLOG_SYSLOG_LOCAL7 (23): Local use 7
PARAMETERS
logger Logger handle.
facility The facility code to use (clog_syslog_facility). A value
that the enum does not name (12 to 15, or anything outside
0 to 23, such as 99 or -1) is refused and the facility stays
as it is, which keeps the PRI of every record in the range
0 to 191 that RFC 5424 allows.
RETURN VALUE
ccol_success The facility is set.
ccol_invalid_args clog_syslog_facility does not name facility. The
facility stays as it is.
NOTES
Thread-safe, because the mutex of the shared backing store protects the call. The default facility is CLOG_SYSLOG_USER. Asserts when logger is CLOG_NULL, stale or already closed.