The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * 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 | * * Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * * Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in |
| 12 | * the documentation and/or other materials provided with the |
| 13 | * distribution. |
| 14 | * |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 16 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 18 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 19 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 22 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 25 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 26 | * SUCH DAMAGE. |
| 27 | */ |
Elliott Hughes | a382a79 | 2014-06-09 17:16:19 -0700 | [diff] [blame] | 28 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 29 | #ifndef _SYSLOG_H |
| 30 | #define _SYSLOG_H |
| 31 | |
| 32 | #include <stdio.h> |
| 33 | #include <sys/cdefs.h> |
| 34 | #include <stdarg.h> |
| 35 | |
| 36 | __BEGIN_DECLS |
| 37 | |
Elliott Hughes | afe6360 | 2014-07-23 11:38:38 -0700 | [diff] [blame] | 38 | /* Priorities are translated to Android log priorities as shown. */ |
| 39 | #define LOG_EMERG 0 /* ERROR */ |
| 40 | #define LOG_ALERT 1 /* ERROR */ |
| 41 | #define LOG_CRIT 2 /* ERROR */ |
| 42 | #define LOG_ERR 3 /* ERROR */ |
| 43 | #define LOG_WARNING 4 /* WARN */ |
| 44 | #define LOG_NOTICE 5 /* INFO */ |
| 45 | #define LOG_INFO 6 /* INFO */ |
| 46 | #define LOG_DEBUG 7 /* DEBUG */ |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 47 | |
Elliott Hughes | afe6360 | 2014-07-23 11:38:38 -0700 | [diff] [blame] | 48 | #define LOG_PRIMASK 7 |
| 49 | #define LOG_PRI(x) ((x) & LOG_PRIMASK) |
Mark Salyzyn | c4a586d | 2015-03-12 13:21:35 -0700 | [diff] [blame] | 50 | #define LOG_MAKEPRI(fac, pri) ((fac) | (pri)) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 51 | |
Elliott Hughes | afe6360 | 2014-07-23 11:38:38 -0700 | [diff] [blame] | 52 | /* Facilities are currently ignored on Android. */ |
Elliott Hughes | f517288 | 2017-08-03 14:44:13 -0700 | [diff] [blame] | 53 | #define LOG_KERN (0<<3) |
| 54 | #define LOG_USER (1<<3) |
| 55 | #define LOG_MAIL (2<<3) |
| 56 | #define LOG_DAEMON (3<<3) |
| 57 | #define LOG_AUTH (4<<3) |
| 58 | #define LOG_SYSLOG (5<<3) |
| 59 | #define LOG_LPR (6<<3) |
| 60 | #define LOG_NEWS (7<<3) |
| 61 | #define LOG_UUCP (8<<3) |
| 62 | #define LOG_CRON (9<<3) |
| 63 | #define LOG_AUTHPRIV (10<<3) |
| 64 | #define LOG_FTP (11<<3) |
| 65 | #define LOG_LOCAL0 (16<<3) |
| 66 | #define LOG_LOCAL1 (17<<3) |
| 67 | #define LOG_LOCAL2 (18<<3) |
| 68 | #define LOG_LOCAL3 (19<<3) |
| 69 | #define LOG_LOCAL4 (20<<3) |
| 70 | #define LOG_LOCAL5 (21<<3) |
| 71 | #define LOG_LOCAL6 (22<<3) |
| 72 | #define LOG_LOCAL7 (23<<3) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 73 | |
Elliott Hughes | f517288 | 2017-08-03 14:44:13 -0700 | [diff] [blame] | 74 | #define LOG_NFACILITIES 24 |
| 75 | #define LOG_FACMASK 0x3f8 |
Elliott Hughes | afe6360 | 2014-07-23 11:38:38 -0700 | [diff] [blame] | 76 | #define LOG_FAC(x) (((x) >> 3) & (LOG_FACMASK >> 3)) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 77 | |
Elliott Hughes | a382a79 | 2014-06-09 17:16:19 -0700 | [diff] [blame] | 78 | #define LOG_MASK(pri) (1 << (pri)) |
| 79 | #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 80 | |
Elliott Hughes | afe6360 | 2014-07-23 11:38:38 -0700 | [diff] [blame] | 81 | /* openlog(3) flags are currently ignored on Android. */ |
Elliott Hughes | 3ad8ecb | 2014-07-21 16:35:24 -0700 | [diff] [blame] | 82 | #define LOG_PID 0x01 |
| 83 | #define LOG_CONS 0x02 |
| 84 | #define LOG_ODELAY 0x04 |
| 85 | #define LOG_NDELAY 0x08 |
| 86 | #define LOG_NOWAIT 0x10 |
| 87 | #define LOG_PERROR 0x20 |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 88 | |
Elliott Hughes | afe6360 | 2014-07-23 11:38:38 -0700 | [diff] [blame] | 89 | void closelog(void); |
Elliott Hughes | faa7434 | 2017-08-11 17:34:44 -0700 | [diff] [blame] | 90 | void openlog(const char* __prefix, int __option, int __facility); |
| 91 | int setlogmask(int __mask); |
| 92 | void syslog(int __priority, const char* __fmt, ...) __printflike(2, 3); |
| 93 | void vsyslog(int __priority, const char* __fmt, va_list __args) __printflike(2, 0); |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 94 | |
| 95 | __END_DECLS |
| 96 | |
| 97 | #endif /* _SYSLOG_H */ |