Path: blob/21.2-virgl/include/android_stub/log/log_radio.h
4547 views
/*1* Copyright (C) 2005-2017 The Android Open Source Project2*3* Licensed under the Apache License, Version 2.0 (the "License");4* you may not use this file except in compliance with the License.5* You may obtain a copy of the License at6*7* http://www.apache.org/licenses/LICENSE-2.08*9* Unless required by applicable law or agreed to in writing, software10* distributed under the License is distributed on an "AS IS" BASIS,11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12* See the License for the specific language governing permissions and13* limitations under the License.14*/1516#pragma once1718#include <android/log.h>1920/*21* Normally we strip the effects of ALOGV (VERBOSE messages),22* LOG_FATAL and LOG_FATAL_IF (FATAL assert messages) from the23* release builds be defining NDEBUG. You can modify this (for24* example with "#define LOG_NDEBUG 0" at the top of your source25* file) to change that behavior.26*/2728#ifndef LOG_NDEBUG29#ifdef NDEBUG30#define LOG_NDEBUG 131#else32#define LOG_NDEBUG 033#endif34#endif3536/* --------------------------------------------------------------------- */3738#ifndef __predict_false39#define __predict_false(exp) __builtin_expect((exp) != 0, 0)40#endif4142/*43* Simplified macro to send a verbose radio log message using current LOG_TAG.44*/45#ifndef RLOGV46#define __RLOGV(...) \47((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_VERBOSE, LOG_TAG, \48__VA_ARGS__))49#if LOG_NDEBUG50#define RLOGV(...) \51do { \52if (0) { \53__RLOGV(__VA_ARGS__); \54} \55} while (0)56#else57#define RLOGV(...) __RLOGV(__VA_ARGS__)58#endif59#endif6061#ifndef RLOGV_IF62#if LOG_NDEBUG63#define RLOGV_IF(cond, ...) ((void)0)64#else65#define RLOGV_IF(cond, ...) \66((__predict_false(cond)) \67? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_VERBOSE, \68LOG_TAG, __VA_ARGS__)) \69: (void)0)70#endif71#endif7273/*74* Simplified macro to send a debug radio log message using current LOG_TAG.75*/76#ifndef RLOGD77#define RLOGD(...) \78((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_DEBUG, LOG_TAG, \79__VA_ARGS__))80#endif8182#ifndef RLOGD_IF83#define RLOGD_IF(cond, ...) \84((__predict_false(cond)) \85? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_DEBUG, \86LOG_TAG, __VA_ARGS__)) \87: (void)0)88#endif8990/*91* Simplified macro to send an info radio log message using current LOG_TAG.92*/93#ifndef RLOGI94#define RLOGI(...) \95((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_INFO, LOG_TAG, \96__VA_ARGS__))97#endif9899#ifndef RLOGI_IF100#define RLOGI_IF(cond, ...) \101((__predict_false(cond)) \102? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_INFO, \103LOG_TAG, __VA_ARGS__)) \104: (void)0)105#endif106107/*108* Simplified macro to send a warning radio log message using current LOG_TAG.109*/110#ifndef RLOGW111#define RLOGW(...) \112((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_WARN, LOG_TAG, \113__VA_ARGS__))114#endif115116#ifndef RLOGW_IF117#define RLOGW_IF(cond, ...) \118((__predict_false(cond)) \119? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_WARN, \120LOG_TAG, __VA_ARGS__)) \121: (void)0)122#endif123124/*125* Simplified macro to send an error radio log message using current LOG_TAG.126*/127#ifndef RLOGE128#define RLOGE(...) \129((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_ERROR, LOG_TAG, \130__VA_ARGS__))131#endif132133#ifndef RLOGE_IF134#define RLOGE_IF(cond, ...) \135((__predict_false(cond)) \136? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_ERROR, \137LOG_TAG, __VA_ARGS__)) \138: (void)0)139#endif140141142