1/* 2 * Copyright 2003-2012 Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef _SYSLOG_H_ 6#define _SYSLOG_H_ 7 8 9#include <stdarg.h> 10 11 12/* options for openlog() */ 13 14#define LOG_PID (1 << 12) /* log the process (thread/team) ID with each message */ 15#define LOG_CONS (2 << 12) /* log to the system console on error */ 16#define LOG_ODELAY (4 << 12) /* delay open until syslog() is called */ 17#define LOG_NDELAY (8 << 12) /* connect to the syslog daemon immediately */ 18#define LOG_SERIAL (16 << 12) /* dump to serial output as well (not implemented) */ 19#define LOG_PERROR (32 << 12) /* dump to stderr as well */ 20#define LOG_NOWAIT (64 << 12) /* do not wait for child processes */ 21 22 23/* facilities */ 24 25#define LOG_KERN (0 << 3) /* messages generated by the kernel */ 26#define LOG_USER (1 << 3) /* by user processes */ 27#define LOG_MAIL (2 << 3) 28#define LOG_DAEMON (3 << 3) 29#define LOG_AUTH (4 << 3) 30#define LOG_SYSLOG (5 << 3) /* messages generated internally by syslogd */ 31#define LOG_LPR (6 << 3) 32#define LOG_NEWS (7 << 3) 33#define LOG_UUCP (8 << 3) 34#define LOG_CRON (9 << 3) 35#define LOG_AUTHPRIV (10 << 3) /* security/authorization messages (private) */ 36#define LOG_FTP (11 << 3) 37 38/* these are for local use: */ 39#define LOG_LOCAL0 (16 << 3) 40#define LOG_LOCAL1 (17 << 3) 41#define LOG_LOCAL2 (18 << 3) 42#define LOG_LOCAL3 (19 << 3) 43#define LOG_LOCAL4 (20 << 3) 44#define LOG_LOCAL5 (21 << 3) 45#define LOG_LOCAL6 (22 << 3) 46#define LOG_LOCAL7 (23 << 3) 47 48#define LOG_NFACILITIES (24) /* current number of facilities */ 49#define LOG_FACMASK (0x03f8) /* mask to extract facility part */ 50#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) 51 52/* priorities */ 53 54#define LOG_EMERG 0 /* a panic condition */ 55#define LOG_PANIC LOG_EMERG 56#define LOG_ALERT 1 /* a condition that should be corrected immediately */ 57#define LOG_CRIT 2 /* critical conditions like hard drive errors */ 58#define LOG_ERR 3 59#define LOG_WARNING 4 60#define LOG_NOTICE 5 61#define LOG_INFO 6 62#define LOG_DEBUG 7 63 64#define LOG_PRIMASK (0x7) /* mask to extract priority part */ 65#define LOG_PRI(p) ((p) & LOG_PRIMASK) 66 67/* turns a priority into a mask usable for setlogmask() */ 68#define LOG_MASK(pri) (1 << (pri)) 69#define LOG_UPTO(pri) ((1 << ((pri) + 1)) - 1) 70 71 72#ifdef __cplusplus 73extern "C" { 74#endif 75 76/* POSIX calls */ 77extern void closelog(void); 78extern void openlog(const char *ident, int options, int facility); 79extern int setlogmask(int priorityMask); 80extern void syslog(int priority, const char *message, ...); 81 82/* Be extensions */ 83extern void closelog_team(void); 84extern void openlog_team(const char *ident, int logopt, int facility); 85extern void log_team(int priority, const char *message, ...); 86extern int setlogmask_team(int priorityMask); 87 88extern void closelog_thread(void); 89extern void openlog_thread(const char *ident, int logopt, int facility); 90extern void log_thread(int priority, const char *message, ...); 91extern int setlogmask_thread(int priorityMask); 92 93/* BSD extensions */ 94extern void vsyslog(int priority, const char *message, va_list args); 95 96#ifdef __cplusplus 97} 98#endif 99 100#endif /* _SYSLOG_H_ */ 101