17372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh/* 27372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * Copyright (C) 2008 The Android Open Source Project 37372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * All rights reserved. 47372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * 57372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * Redistribution and use in source and binary forms, with or without 67372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * modification, are permitted provided that the following conditions 77372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * are met: 87372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * * Redistributions of source code must retain the above copyright 97372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * notice, this list of conditions and the following disclaimer. 107372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * * Redistributions in binary form must reproduce the above copyright 117372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * notice, this list of conditions and the following disclaimer in 127372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * the documentation and/or other materials provided with the 137372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * distribution. 147372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * 157372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 167372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 177372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 187372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 197372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 207372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 217372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 227372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 237372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 247372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 257372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 267372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh * SUCH DAMAGE. 277372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh */ 281b55d7b281f282232ee58da5d09d3da5969ff11dAndrew Hsieh 297372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh#ifndef _SYSLOG_H 307372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh#define _SYSLOG_H 317372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh 327372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh#include <stdio.h> 337372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh#include <sys/cdefs.h> 347372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh#include <stdarg.h> 357372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh 367372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh__BEGIN_DECLS 377372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh 3870265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh/* Priorities are translated to Android log priorities as shown. */ 3970265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_EMERG 0 /* ERROR */ 4070265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_ALERT 1 /* ERROR */ 4170265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_CRIT 2 /* ERROR */ 4270265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_ERR 3 /* ERROR */ 4370265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_WARNING 4 /* WARN */ 4470265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_NOTICE 5 /* INFO */ 4570265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_INFO 6 /* INFO */ 4670265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_DEBUG 7 /* DEBUG */ 477372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh 4870265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_PRIMASK 7 4970265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_PRI(x) ((x) & LOG_PRIMASK) 507372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh 5170265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh/* Facilities are currently ignored on Android. */ 5270265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_KERN 0000 5370265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_USER 0010 5470265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_MAIL 0020 5570265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_DAEMON 0030 5670265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_AUTH 0040 5770265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_SYSLOG 0050 5870265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_LPR 0060 5970265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_NEWS 0070 6070265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_UUCP 0100 6170265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_CRON 0110 6270265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_AUTHPRIV 0120 6370265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_FTP 0130 6470265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_LOCAL0 0200 6570265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_LOCAL1 0210 6670265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_LOCAL2 0220 6770265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_LOCAL3 0230 6870265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_LOCAL4 0240 6970265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_LOCAL5 0250 7070265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_LOCAL6 0260 7170265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_LOCAL7 0270 727372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh 7370265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_FACMASK 01770 7470265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_FAC(x) (((x) >> 3) & (LOG_FACMASK >> 3)) 757372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh 761b55d7b281f282232ee58da5d09d3da5969ff11dAndrew Hsieh#define LOG_MASK(pri) (1 << (pri)) 771b55d7b281f282232ee58da5d09d3da5969ff11dAndrew Hsieh#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) 787372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh 7970265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh/* openlog(3) flags are currently ignored on Android. */ 8070265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_PID 0x01 8170265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_CONS 0x02 8270265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_ODELAY 0x04 8370265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_NDELAY 0x08 8470265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_NOWAIT 0x10 8570265c95acca4be96f4c82ad80645e67fe718094Andrew Hsieh#define LOG_PERROR 0x20 867372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh 8770265c95acca4be96f4c82ad80645e67fe718094Andrew Hsiehvoid closelog(void); 8870265c95acca4be96f4c82ad80645e67fe718094Andrew Hsiehvoid openlog(const char*, int, int); 8970265c95acca4be96f4c82ad80645e67fe718094Andrew Hsiehint setlogmask(int); 9070265c95acca4be96f4c82ad80645e67fe718094Andrew Hsiehvoid syslog(int, const char*, ...) __printflike(2, 3); 9170265c95acca4be96f4c82ad80645e67fe718094Andrew Hsiehvoid vsyslog(int, const char*, va_list) __printflike(2, 0); 927372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh 937372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh__END_DECLS 947372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh 957372bd5a6d7d0cb636bdfdd27ca99b2d6abc0f2cAndrew Hsieh#endif /* _SYSLOG_H */ 96