OSDN Git Service

Bulk-extend copyright headers to 2015
[android-x86/hardware-intel-libsensors.git] / linux / utils / Log.h
1 /*
2  * Copyright (C) 2014-2015 Intel Corporation.
3  */
4
5 #ifndef _LINUX_ALOG_H
6 #define _LINUX_ALOG_H
7
8 #include <errno.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <linux/limits.h>
12 #include <string.h>
13 #include <time.h>
14 #include <unistd.h>
15
16
17 #ifndef ALOGE
18 #define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
19 #endif
20
21 #ifndef ALOGI
22 #define ALOGI(...) ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__))
23 #endif
24
25 #ifndef ALOGD
26 #define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
27 #endif
28
29 #ifndef ALOGW
30 #define ALOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
31 #endif
32
33 #ifndef ALOGV
34 #define ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
35 #endif
36
37 #ifndef ALOG
38 #define ALOG(priority, tag, ...) \
39     LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__)
40 #endif
41
42 #ifndef LOG_PRI
43 #define LOG_PRI(priority, tag, ...) \
44     android_printLog(priority, tag, __VA_ARGS__)
45 #endif
46
47 #define android_printLog(prio, tag, fmt...) \
48     __android_log_print(prio, tag, fmt)
49
50 typedef enum android_LogPriority {
51         ANDROID_LOG_UNKNOWN = 0,
52         ANDROID_LOG_DEFAULT,    /* only for SetMinPriority() */
53         ANDROID_LOG_VERBOSE,
54         ANDROID_LOG_DEBUG,
55         ANDROID_LOG_INFO,
56         ANDROID_LOG_WARN,
57         ANDROID_LOG_ERROR,
58         ANDROID_LOG_FATAL,
59         ANDROID_LOG_SILENT,     /* only for SetMinPriority(); must be last */
60 } android_LogPriority;
61
62 extern int __android_log_print(int prio, const char *tag, const char *fmt, ...);
63
64 #endif
65