1/* 2 * Copyright 2013 The Android Open Source Project 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 NATIVEHELPER_ALOGPRIV_H_ 18#define NATIVEHELPER_ALOGPRIV_H_ 19 20#include <android/log.h> 21 22#ifndef LOG_NDEBUG 23#ifdef NDEBUG 24#define LOG_NDEBUG 1 25#else 26#define LOG_NDEBUG 0 27#endif 28#endif 29 30 31/* 32 * Basic log message macros intended to emulate the behavior of log/log.h 33 * in system core. This should be dependent only on ndk exposed logging 34 * functionality. 35 */ 36 37#ifndef ALOG 38#define ALOG(priority, tag, fmt...) \ 39 __android_log_print(ANDROID_##priority, tag, fmt) 40#endif 41 42#ifndef ALOGV 43#if LOG_NDEBUG 44#define ALOGV(...) ((void)0) 45#else 46#define ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) 47#endif 48#endif 49 50#ifndef ALOGD 51#define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) 52#endif 53 54#ifndef ALOGI 55#define ALOGI(...) ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) 56#endif 57 58#ifndef ALOGW 59#define ALOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) 60#endif 61 62#ifndef ALOGE 63#define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) 64#endif 65 66#endif 67