1 /*
2  * log.h, logging helper
3  *
4  * Copyright (c) 2009-2010 Wind River Systems, Inc.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef __LOG_H
20 #define __LOG_H
21 
22 #ifdef ANDROID
23  #include <cutils/log.h>
24  #define LOGV ALOGV
25  #define LOGD ALOGD
26  #define LOGI ALOGI
27  #define LOGW ALOGW
28  #define LOGE ALOGE
29  #define LOGV_IF ALOGV_IF
30  #define LOGD_IF ALOGD_IF
31  #define LOGI_IF ALOGI_IF
32  #define LOGW_IF ALOGW_IF
33  #define LOGE_IF ALOGE_IF
34 #else
35  #include <stdio.h>
36  #define LOG(_p, ...) \
37       fprintf(stderr, _p "/" LOG_TAG ": " __VA_ARGS__)
38  #define LOGV(...)   LOG("V", __VA_ARGS__)
39  #define LOGD(...)   LOG("D", __VA_ARGS__)
40  #define LOGI(...)   LOG("I", __VA_ARGS__)
41  #define LOGW(...)   LOG("W", __VA_ARGS__)
42  #define LOGE(...)   LOG("E", __VA_ARGS__)
43 #endif
44 
45 #endif /* __LOG_H */
46