2008-02-02 20:32:01 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2003-2008, Haiku Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2003-11-12 17:40:45 +03:00
|
|
|
#ifndef _SYSLOG_H_
|
|
|
|
#define _SYSLOG_H_
|
|
|
|
|
|
|
|
|
2008-02-03 18:31:16 +03:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
|
2008-02-02 20:32:01 +03:00
|
|
|
/* options for openlog() */
|
2003-11-12 19:33:11 +03:00
|
|
|
|
2003-11-12 17:40:45 +03:00
|
|
|
#define LOG_PID (1 << 12) /* log the process (thread/team) ID with each message */
|
|
|
|
#define LOG_CONS (2 << 12) /* log to the system console on error */
|
|
|
|
#define LOG_ODELAY (4 << 12) /* delay open until syslog() is called */
|
|
|
|
#define LOG_NDELAY (8 << 12) /* connect to the syslog daemon immediately */
|
2003-11-13 06:30:21 +03:00
|
|
|
#define LOG_SERIAL (16 << 12) /* dump to serial output as well (not implemented) */
|
|
|
|
#define LOG_PERROR (32 << 12) /* dump to stderr as well */
|
2003-11-12 17:40:45 +03:00
|
|
|
#define LOG_NOWAIT (64 << 12) /* do not wait for child processes */
|
|
|
|
|
2003-11-12 19:33:11 +03:00
|
|
|
|
2008-02-02 20:32:01 +03:00
|
|
|
/* facilities */
|
2003-11-12 19:33:11 +03:00
|
|
|
|
2003-11-12 17:40:45 +03:00
|
|
|
#define LOG_KERN (0 << 3) /* messages generated by the kernel */
|
|
|
|
#define LOG_USER (1 << 3) /* by user processes */
|
|
|
|
#define LOG_MAIL (2 << 3)
|
|
|
|
#define LOG_DAEMON (3 << 3)
|
|
|
|
#define LOG_AUTH (4 << 3)
|
|
|
|
#define LOG_SYSLOG (5 << 3)
|
|
|
|
#define LOG_LPR (6 << 3)
|
|
|
|
#define LOG_NEWS (7 << 3)
|
|
|
|
#define LOG_UUCP (8 << 3)
|
|
|
|
#define LOG_CRON (9 << 3)
|
2003-11-12 19:33:11 +03:00
|
|
|
#define LOG_AUTHPRIV (10 << 3)
|
2008-02-02 20:32:01 +03:00
|
|
|
#define LOG_FTP (11 << 3)
|
2003-11-12 17:40:45 +03:00
|
|
|
|
2003-11-12 19:33:11 +03:00
|
|
|
/* these are for local use: */
|
2003-11-12 17:40:45 +03:00
|
|
|
#define LOG_LOCAL0 (16 << 3)
|
|
|
|
#define LOG_LOCAL1 (17 << 3)
|
|
|
|
#define LOG_LOCAL2 (18 << 3)
|
|
|
|
#define LOG_LOCAL3 (19 << 3)
|
|
|
|
#define LOG_LOCAL4 (20 << 3)
|
|
|
|
#define LOG_LOCAL5 (21 << 3)
|
|
|
|
#define LOG_LOCAL6 (22 << 3)
|
|
|
|
#define LOG_LOCAL7 (23 << 3)
|
|
|
|
|
2003-11-12 19:33:11 +03:00
|
|
|
|
2008-02-02 20:32:01 +03:00
|
|
|
/* priorities */
|
2003-11-12 17:40:45 +03:00
|
|
|
|
|
|
|
#define LOG_EMERG 0 /* a panic condition */
|
|
|
|
#define LOG_PANIC LOG_EMERG
|
|
|
|
#define LOG_ALERT 1 /* a condition that should be corrected immediately */
|
|
|
|
#define LOG_CRIT 2 /* critical conditions like hard drive errors */
|
|
|
|
#define LOG_ERR 3
|
|
|
|
#define LOG_WARNING 4
|
|
|
|
#define LOG_NOTICE 5
|
|
|
|
#define LOG_INFO 6
|
|
|
|
#define LOG_DEBUG 7
|
|
|
|
|
2003-11-12 19:33:11 +03:00
|
|
|
/* turns a priority into a mask usable for setlogmask() */
|
|
|
|
#define LOG_MASK(pri) (1 << (pri))
|
|
|
|
|
2003-11-12 17:40:45 +03:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2008-02-02 20:32:01 +03:00
|
|
|
/* POSIX calls */
|
2003-11-12 17:40:45 +03:00
|
|
|
extern void closelog(void);
|
|
|
|
extern void openlog(const char *ident, int options, int facility);
|
|
|
|
extern int setlogmask(int priorityMask);
|
|
|
|
extern void syslog(int priority, const char *message, ...);
|
|
|
|
|
2008-02-02 20:32:01 +03:00
|
|
|
/* Be extensions */
|
2003-11-12 17:40:45 +03:00
|
|
|
extern void closelog_team(void);
|
|
|
|
extern void openlog_team(const char *ident, int logopt, int facility);
|
|
|
|
extern void log_team(int priority, const char *message, ...);
|
|
|
|
extern int setlogmask_team(int priorityMask);
|
|
|
|
|
|
|
|
extern void closelog_thread(void);
|
|
|
|
extern void openlog_thread(const char *ident, int logopt, int facility);
|
|
|
|
extern void log_thread(int priority, const char *message, ...);
|
|
|
|
extern int setlogmask_thread(int priorityMask);
|
|
|
|
|
2008-02-03 18:31:16 +03:00
|
|
|
/* BSD extensions */
|
|
|
|
extern void vsyslog(int priority, const char *message, va_list args);
|
|
|
|
|
2003-11-12 17:40:45 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _SYSLOG_H_ */
|