2 * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
4 * Contact: Suresh Kumar N (suresh.n@samsung.com)
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #ifndef __ZIGBEE_LIB_LOG_H__
20 #define __ZIGBEE_LIB_LOG_H__
24 #ifndef TIZEN_DEBUG_ENABLE
25 #define TIZEN_DEBUG_ENABLE
28 /**< ZigBee debug flag */
29 extern gboolean zblib_debug;
31 #ifndef ZIGBEE_LOG_TAG
32 #define ZIGBEE_LOG_TAG "UNKNOWN"
36 ZIGBEE_LOG_TYPE_MAIN = 0,
37 ZIGBEE_LOG_TYPE_RADIO,
38 ZIGBEE_LOG_TYPE_SYSTEM,
39 ZIGBEE_LOG_TYPE_TIME_CHECK
42 enum zblib_log_priority {
43 ZIGBEE_LOG_UNKNOWN = 0,
54 void zblib_log(enum zblib_log_type type, enum zblib_log_priority priority, const char *tag, const char *fmt, ...);
56 /* Logs would be available in system logs */
57 #define Z_LOGI(fmt,args...) do { if(zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0)
58 #define Z_LOGM(fmt,args...) do { if(zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, fmt "\n", ##args); } while (0)
59 #define Z_LOGD(fmt,args...) do { if(zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_DEBUG, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0)
60 #define Z_LOGW(fmt,args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_WARN, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0)
61 #define Z_LOGE(fmt,args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_ERROR, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0)
62 #define Z_LOGF(fmt,args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_FATAL, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0)
64 #define Z_TIME_CHECK(fmt,args...) do { zblib_log(ZIGBEE_LOG_TYPE_TIME_CHECK, ZIGBEE_LOG_INFO, "TIME_CHECK", fmt "\n", ##args); } while (0)
66 #endif /* __ZIGBEE_LIB_LOG_H__ */