[SECSFV-22] Change uid/gid to network_fw
[platform/core/connectivity/zigbee-manager.git] / zigbee-daemon / zigbee-lib / include / zblib_log.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Contact: Suresh Kumar N (suresh.n@samsung.com)
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 __ZIGBEE_LIB_LOG_H__
20 #define __ZIGBEE_LIB_LOG_H__
21
22 #include <glib.h>
23
24 #ifndef TIZEN_DEBUG_ENABLE
25 #define TIZEN_DEBUG_ENABLE
26 #endif
27
28 /**< ZigBee debug flag */
29 extern gboolean zblib_debug;
30
31 #ifndef ZIGBEE_LOG_TAG
32 #define ZIGBEE_LOG_TAG "UNKNOWN"
33 #endif
34
35 enum zblib_log_type {
36         ZIGBEE_LOG_TYPE_MAIN = 0,
37         ZIGBEE_LOG_TYPE_RADIO,
38         ZIGBEE_LOG_TYPE_SYSTEM,
39         ZIGBEE_LOG_TYPE_TIME_CHECK
40 };
41
42 enum zblib_log_priority {
43         ZIGBEE_LOG_UNKNOWN = 0,
44         ZIGBEE_LOG_DEFAULT,
45         ZIGBEE_LOG_VERBOSE,
46         ZIGBEE_LOG_DEBUG,
47         ZIGBEE_LOG_INFO,
48         ZIGBEE_LOG_WARN,
49         ZIGBEE_LOG_ERROR,
50         ZIGBEE_LOG_FATAL,
51         ZIGBEE_LOG_SILENT
52 };
53
54 void zblib_log(enum zblib_log_type type, enum zblib_log_priority priority, const char *tag, const char *fmt, ...);
55
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)
63
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)
65
66 #endif /* __ZIGBEE_LIB_LOG_H__ */