1 /* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. 2 * 3 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions are 5 * met: 6 * * Redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer. 8 * * Redistributions in binary form must reproduce the above 9 * copyright notice, this list of conditions and the following 10 * disclaimer in the documentation and/or other materials provided 11 * with the distribution. 12 * * Neither the name of The Linux Foundation, nor the names of its 13 * contributors may be used to endorse or promote products derived 14 * from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 #ifndef LOC_UTIL_LOG_H 29 #define LOC_UTIL_LOG_H 30 31 #if defined(_ANDROID_) 32 #include "loc_api_v02_log.h" 33 #include <log_util.h> 34 35 #else // no _ANDROID_ 36 37 #if defined(__LOC_API_V02_LOG_SILENT__) 38 #define MSG_LOG 39 #define LOC_LOGE(...) MSG_LOG(__VA_ARGS__); 40 #define LOC_LOGW(...) MSG_LOG(__VA_ARGS__); 41 #define LOC_LOGD(...) MSG_LOG(__VA_ARGS__); 42 #define LOC_LOGI(...) MSG_LOG(__VA_ARGS__); 43 #define LOC_LOGV(...) MSG_LOG(__VA_ARGS__); 44 #else 45 46 // common for QNX and Griffon 47 48 //error logs 49 #define LOC_LOGE(...) printf(__VA_ARGS__) 50 //warning logs 51 #define LOC_LOGW(...) printf(__VA_ARGS__) 52 // debug logs 53 #define LOC_LOGD(...) printf(__VA_ARGS__) 54 //info logs 55 #define LOC_LOGI(...) printf(__VA_ARGS__) 56 //verbose logs 57 #define LOC_LOGV(...) printf(__VA_ARGS__) 58 #endif //__LOC_API_V02_LOG_SILENT__ 59 60 #define MODEM_LOG_CALLFLOW(SPEC, VAL) 61 #define EXIT_LOG_CALLFLOW(SPEC, VAL) 62 63 #define loc_get_v02_event_name(X) #X 64 #define loc_get_v02_client_status_name(X) #X 65 66 #define loc_get_v02_qmi_status_name(X) #X 67 68 //specific to OFF TARGET 69 #ifdef LOC_UTIL_TARGET_OFF_TARGET 70 71 #include <stdio.h> 72 # include <asm/errno.h> 73 # include <sys/time.h> 74 75 // get around strl*: not found in glibc 76 // TBD:look for presence of eglibc other libraries 77 // with strlcpy supported. 78 #define strlcpy(X,Y,Z) strcpy(X,Y) 79 #define strlcat(X,Y,Z) strcat(X,Y) 80 81 #endif //LOC_UTIL_TARGET_OFF_TARGET 82 83 #endif //_ANDROID_ 84 85 #endif //LOC_UTIL_LOG_H 86