1 /* 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 4. Neither the name of the University nor the names of its contributors 14 * may be used to endorse or promote products derived from this software 15 * without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30 #ifndef _SYSLOG_H 31 #define _SYSLOG_H 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 /* 38 * Facility codes 39 */ 40 #define LOG_KERN (0<<3) /* kernel messages */ 41 #define LOG_USER (1<<3) /* random user-level messages */ 42 #define LOG_MAIL (2<<3) /* mail system */ 43 #define LOG_DAEMON (3<<3) /* system daemons */ 44 #define LOG_AUTH (4<<3) /* security/authorization messages */ 45 #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ 46 #define LOG_LPR (6<<3) /* line printer subsystem */ 47 #define LOG_NEWS (7<<3) /* netnews subsystem */ 48 #define LOG_UUCP (8<<3) /* uucp subsystem */ 49 #define LOG_AUDIT (13<<3) /* audit subsystem */ 50 #define LOG_CRON (15<<3) /* cron/at subsystem */ 51 /* other codes through 15 reserved for system use */ 52 #define LOG_LOCAL0 (16<<3) /* reserved for local use */ 53 #define LOG_LOCAL1 (17<<3) /* reserved for local use */ 54 #define LOG_LOCAL2 (18<<3) /* reserved for local use */ 55 #define LOG_LOCAL3 (19<<3) /* reserved for local use */ 56 #define LOG_LOCAL4 (20<<3) /* reserved for local use */ 57 #define LOG_LOCAL5 (21<<3) /* reserved for local use */ 58 #define LOG_LOCAL6 (22<<3) /* reserved for local use */ 59 #define LOG_LOCAL7 (23<<3) /* reserved for local use */ 60 61 #define LOG_NFACILITIES 24 /* maximum number of facilities */ 62 #define LOG_FACMASK 0x03f8 /* mask to extract facility part */ 63 64 /* 65 * Priorities (these are ordered) 66 */ 67 #define LOG_EMERG 0 /* system is unusable */ 68 #define LOG_ALERT 1 /* action must be taken immediately */ 69 #define LOG_CRIT 2 /* critical conditions */ 70 #define LOG_ERR 3 /* error conditions */ 71 #define LOG_WARNING 4 /* warning conditions */ 72 #define LOG_NOTICE 5 /* normal but signification condition */ 73 #define LOG_INFO 6 /* informational */ 74 #define LOG_DEBUG 7 /* debug-level messages */ 75 76 #define LOG_PRIMASK 0x0007 /* mask to extract priority part (internal) */ 77 78 /* 79 * arguments to setlogmask. 80 */ 81 #define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ 82 #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ 83 84 /* 85 * Option flags for openlog. 86 * 87 * LOG_ODELAY no longer does anything; LOG_NDELAY is the 88 * inverse of what it used to be. 89 */ 90 #define LOG_PID 0x01 /* log the pid with each message */ 91 #define LOG_CONS 0x02 /* log on the console if errors in sending */ 92 #define LOG_ODELAY 0x04 /* delay open until syslog() is called */ 93 #define LOG_NDELAY 0x08 /* don't delay open */ 94 #define LOG_NOWAIT 0x10 /* if forking to log on console, don't wait() */ 95 96 void syslog(int type, const char *fmt, ...); 97 void openlog(const char *app, int, int); 98 void closelog(void); 99 100 #ifdef __cplusplus 101 } 102 #endif 103 104 #endif /* _SYSLOG_H */ 105