OSDN Git Service

Distribute under Apache License v2.0
[android-x86/hardware-intel-libsensors.git] / linux / utils / Log.h
1 /*
2 // Copyright (c) 2015 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16
17 #ifndef _LINUX_ALOG_H
18 #define _LINUX_ALOG_H
19
20 #include <errno.h>
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <linux/limits.h>
24 #include <string.h>
25 #include <time.h>
26 #include <unistd.h>
27
28
29 #ifndef ALOGE
30 #define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
31 #endif
32
33 #ifndef ALOGI
34 #define ALOGI(...) ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__))
35 #endif
36
37 #ifndef ALOGD
38 #define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
39 #endif
40
41 #ifndef ALOGW
42 #define ALOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
43 #endif
44
45 #ifndef ALOGV
46 #define ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
47 #endif
48
49 #ifndef ALOG
50 #define ALOG(priority, tag, ...) \
51     LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__)
52 #endif
53
54 #ifndef LOG_PRI
55 #define LOG_PRI(priority, tag, ...) \
56     android_printLog(priority, tag, __VA_ARGS__)
57 #endif
58
59 #define android_printLog(prio, tag, fmt...) \
60     __android_log_print(prio, tag, fmt)
61
62 typedef enum android_LogPriority {
63         ANDROID_LOG_UNKNOWN = 0,
64         ANDROID_LOG_DEFAULT,    /* only for SetMinPriority() */
65         ANDROID_LOG_VERBOSE,
66         ANDROID_LOG_DEBUG,
67         ANDROID_LOG_INFO,
68         ANDROID_LOG_WARN,
69         ANDROID_LOG_ERROR,
70         ANDROID_LOG_FATAL,
71         ANDROID_LOG_SILENT,     /* only for SetMinPriority(); must be last */
72 } android_LogPriority;
73
74 extern int __android_log_print(int prio, const char *tag, const char *fmt, ...);
75
76 #endif
77