Macros | Functions
syslog.h File Reference

System logging capabilities. More...

Macros

#define LOG_MASK(pri)   (1 << (pri))
 Converts a priority definition for use in setlogmask()
 
Options for openlog()
#define LOG_CONS   (2 << 12) /* log to the system console on error */
 Log to the system console on error.
 
#define LOG_NDELAY   (8 << 12) /* connect to the syslog daemon immediately */
 Connect to the syslog daemon immediately.
 
#define LOG_NOWAIT   (64 << 12) /* do not wait for child processes */
 Do not wait for child processes.
 
#define LOG_ODELAY   (4 << 12) /* delay open until syslog() is called */
 Delay open until syslog() is called.
 
#define LOG_PERROR   (32 << 12) /* dump to stderr as well */
 Dump to stderr as well.
 
#define LOG_PID   (1 << 12) /* log the process (thread/team) ID with each message */
 Log the process (thread/team) ID with each message.
 
#define LOG_SERIAL   (16 << 12) /* dump to serial output as well (not implemented) */
 Dump to serial output as well. More...
 
Facilities for openlog()
#define LOG_AUTH   (4 << 3)
 Standard POSIX facility(?) for messages by the authentication services.
 
#define LOG_AUTHPRIV   (10 << 3) /* security/authorization messages (private) */
 Reserved for private (?) messages that relate to authentication.
 
#define LOG_CRON   (9 << 3)
 Reserved for messages generated by the CRON daemon.
 
#define LOG_DAEMON   (3 << 3)
 Standard POSIX (?) facility for messages by daemons (and Haiku servers).
 
#define LOG_KERN   (0 << 3) /* messages generated by the kernel */
 Reserved for messages generated by the kernel.
 
#define LOG_LOCAL0   (16 << 3)
 For local use.
 
#define LOG_LOCAL1   (17 << 3)
 For local use.
 
#define LOG_LOCAL2   (18 << 3)
 For local use.
 
#define LOG_LOCAL3   (19 << 3)
 For local use.
 
#define LOG_LOCAL4   (20 << 3)
 For local use.
 
#define LOG_LOCAL5   (21 << 3)
 For local use.
 
#define LOG_LOCAL6   (22 << 3)
 For local use.
 
#define LOG_LOCAL7   (23 << 3)
 For local use.
 
#define LOG_LPR   (6 << 3)
 Reserved for messages generated by the UNIX lpr printing tool.
 
#define LOG_MAIL   (2 << 3)
 Standard (?) POSIX facility for messages by the mailing daemon.
 
#define LOG_NEWS   (7 << 3)
 Reserved for messages generated by something UNIXy that does something with NEWS.
 
#define LOG_SYSLOG   (5 << 3) /* messages generated internally by syslogd */
 Reserved for messages generated by the syslog daemon.
 
#define LOG_USER   (1 << 3) /* by user processes */
 Reserved for messages generated by user processes.
 
#define LOG_UUCP   (8 << 3)
 Reserved for messages generated by UUCP.
 
Priorities for syslog(), log_team() and log_thread()
#define LOG_ALERT   1 /* a condition that should be corrected immediately */
 A condition to that should be corrected immediately.
 
#define LOG_CRIT   2 /* critical conditions like hard drive errors */
 Critical conditions like hard drive errors.
 
#define LOG_DEBUG   7
 Debug information.
 
#define LOG_EMERG   0 /* a panic condition */
 A panic condition.
 
#define LOG_ERR   3
 Errors.
 
#define LOG_INFO   6
 Information, like versions and so.
 
#define LOG_NOTICE   5
 Notices, instructions on how to use certain configuration options.
 
#define LOG_PANIC   LOG_EMERG
 An alias for LOG_EMERG.
 
#define LOG_WARNING   4
 Warnings.
 

Functions

void closelog (void)
 Closes the current log session.
 
void closelog_team (void)
 Closes the log.
 
void closelog_thread (void)
 Closes the log.
 
void log_team (int priority, const char *message,...)
 sends a message to the system log
 
void log_thread (int priority, const char *message,...)
 sends a message to the system log
 
void openlog (const char *ident, int options, int facility)
 Starts a log session, and sets some output options. More...
 
void openlog_team (const char *ident, int logopt, int facility)
 Starts a log session, and sets some output options. More...
 
void openlog_thread (const char *ident, int logopt, int facility)
 Starts a log session, and sets some output options.
 
int setlogmask (int priorityMask)
 sets the logging priority mask
 
int setlogmask_team (int priorityMask)
 sets the logging priority mask
 
int setlogmask_thread (int priorityMask)
 sets the logging priority mask
 
void syslog (int priority, const char *message,...)
 sends a message to the system log
 

Detailed Description

System logging capabilities.

The functions described here are interacting with the syslog_daemon, a server that provides the system logging capabilities. The log can be found in /var/log/syslog.

Macro Definition Documentation

◆ LOG_SERIAL

#define LOG_SERIAL   (16 << 12) /* dump to serial output as well (not implemented) */

Dump to serial output as well.

Attention
This is not yet implemented

Function Documentation

◆ openlog()

void openlog ( const char *  ident,
int  options,
int  facility 
)

Starts a log session, and sets some output options.

Like openlog_thread() this function defines the log session in thread context; the global options set by openlog_team() are not affected by this function.

◆ openlog_team()

void openlog_team ( const char *  ident,
int  logopt,
int  facility 
)

Starts a log session, and sets some output options.

This function defines the team-wide logging options. Thread local sessions started with openlog() or openlog_thread() will inherit the options of the global session.