liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame^] | 1 | /** |
| 2 | @file |
| 3 | DSI_ConnectManager.h |
| 4 | |
| 5 | @brief |
| 6 | This file provides the definitions for quectel log api, and declares the |
| 7 | API functions. |
| 8 | |
| 9 | */ |
| 10 | /*============================================================================ |
| 11 | Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved. |
| 12 | Quectel Wireless Solution Proprietary and Confidential. |
| 13 | =============================================================================*/ |
| 14 | /*=========================================================================== |
| 15 | |
| 16 | EDIT HISTORY FOR MODULE |
| 17 | |
| 18 | This section contains comments describing changes made to the module. |
| 19 | Notice that changes are listed in reverse chronological order. |
| 20 | |
| 21 | |
| 22 | WHEN WHO WHAT, WHERE, WHY |
| 23 | ---------- ------------ ---------------------------------------------------- |
| 24 | 24/07/2019 Nebula.li create |
| 25 | =============================================================================*/ |
| 26 | |
| 27 | #ifndef _QL_LOG_H_ |
| 28 | #define _QL_LOG_H_ |
| 29 | |
| 30 | #ifdef __cplusplus |
| 31 | extern "C" { |
| 32 | #endif |
| 33 | |
| 34 | typedef enum { |
| 35 | QL_LOG_MIN = -1, |
| 36 | QL_LOG_EMERG_LEVEL=0, /* system is unusable */ |
| 37 | QL_LOG_INIT_LEVEL=0, /* log init level */ |
| 38 | QL_LOG_ALERT_LEVEL=1, /* action must be taken immediately */ |
| 39 | QL_LOG_CRIT_LEVEL=2, /* critical conditions */ |
| 40 | QL_LOG_ERR_LEVEL=3, /* error conditions */ |
| 41 | QL_LOG_WARN_LEVEL=4, /* warning conditions */ |
| 42 | QL_LOG_NOTICE_LEVEL=5, /* normal but significant condition */ |
| 43 | QL_LOG_INFO_LEVEL=6, /* informational */ |
| 44 | QL_LOG_DEBUG_LEVEL=7, /* debug-level messages */ |
| 45 | QL_LOG_MAX |
| 46 | } QL_LOG_PRIORITY_E; |
| 47 | |
| 48 | #define QL_LOG_PRORIFY_VERIFY(prio) ((prio)>QL_LOG_MIN && (prio)<QL_LOG_MAX) |
| 49 | |
| 50 | typedef enum { |
| 51 | QL_LOG_ID_MIN = -1, |
| 52 | QL_LOG_ID_MAIN = 0, |
| 53 | QL_LOG_ID_RADIO = 1, |
| 54 | QL_LOG_ID_EVENTS = 2, |
| 55 | QL_LOG_ID_SYSTEM = 3, |
| 56 | QL_LOG_ID_KMSG = 4, |
| 57 | QL_LOG_ID_STDOUT=5, |
| 58 | QL_LOG_ID_MAX |
| 59 | } QL_LOG_ID_E; |
| 60 | |
| 61 | #define QL_LOG_ID_VERIFY(log_id) ((log_id)>QL_LOG_ID_MIN && (log_id)<QL_LOG_ID_MAX) |
| 62 | |
| 63 | #define LOG_BUF_SIZE 2048 |
| 64 | |
| 65 | #define QL_LOG_OPEN() ql_log_open() |
| 66 | #define QL_LOG_CLOSE() ql_log_close() |
| 67 | #define QL_LOG_SETPOS(log_id) ql_log_setpos(log_id) |
| 68 | |
| 69 | #define QL_LOG_DEBUG(fmt, ...) ql_log_print(QL_LOG_DEBUG_LEVEL,__FUNCTION__, __LINE__, fmt, ##__VA_ARGS__) |
| 70 | #define QL_LOG_INFO(fmt, ...) ql_log_print(QL_LOG_INFO_LEVEL,__FUNCTION__, __LINE__, fmt, ##__VA_ARGS__) |
| 71 | #define QL_LOG_WARN(fmt, ...) ql_log_print(QL_LOG_WARN_LEVEL,__FUNCTION__, __LINE__, fmt, ##__VA_ARGS__) |
| 72 | #define QL_LOG_ERROR(fmt, ...) ql_log_print(QL_LOG_ERR_LEVEL,__FUNCTION__, __LINE__, fmt, ##__VA_ARGS__) |
| 73 | |
| 74 | |
| 75 | extern void ql_log_open(); |
| 76 | extern void ql_log_close(); |
| 77 | extern int ql_log_print(QL_LOG_PRIORITY_E prio,const char *func, int line, const char *fmt, ...); |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | #ifdef __cplusplus |
| 83 | } |
| 84 | #endif |
| 85 | |
| 86 | #endif |