2
* Copyright (C) 2005-2017 The Android Open Source Project
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
19
#include <android/log.h>
22
* Normally we strip the effects of ALOGV (VERBOSE messages),
23
* LOG_FATAL and LOG_FATAL_IF (FATAL assert messages) from the
24
* release builds be defining NDEBUG. You can modify this (for
25
* example with "#define LOG_NDEBUG 0" at the top of your source
26
* file) to change that behavior.
37
#ifndef __predict_false
38
#define __predict_false(exp) __builtin_expect((exp) != 0, 0)
42
* Simplified macro to send a verbose system log message using current LOG_TAG.
45
#define __SLOGV(...) \
46
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, LOG_TAG, \
52
__SLOGV(__VA_ARGS__); \
56
#define SLOGV(...) __SLOGV(__VA_ARGS__)
62
#define SLOGV_IF(cond, ...) ((void)0)
64
#define SLOGV_IF(cond, ...) \
65
((__predict_false(cond)) \
66
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, \
67
LOG_TAG, __VA_ARGS__)) \
73
* Simplified macro to send a debug system log message using current LOG_TAG.
77
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_DEBUG, LOG_TAG, \
82
#define SLOGD_IF(cond, ...) \
83
((__predict_false(cond)) \
84
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_DEBUG, \
85
LOG_TAG, __VA_ARGS__)) \
90
* Simplified macro to send an info system log message using current LOG_TAG.
94
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, LOG_TAG, \
99
#define SLOGI_IF(cond, ...) \
100
((__predict_false(cond)) \
101
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, \
102
LOG_TAG, __VA_ARGS__)) \
107
* Simplified macro to send a warning system log message using current LOG_TAG.
111
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_WARN, LOG_TAG, \
116
#define SLOGW_IF(cond, ...) \
117
((__predict_false(cond)) \
118
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_WARN, \
119
LOG_TAG, __VA_ARGS__)) \
124
* Simplified macro to send an error system log message using current LOG_TAG.
128
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, LOG_TAG, \
133
#define SLOGE_IF(cond, ...) \
134
((__predict_false(cond)) \
135
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, \
136
LOG_TAG, __VA_ARGS__)) \