quec_log.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /** @file
  2. quec_log.h
  3. @brief
  4. This file is used to define version information for different Quectel Project.
  5. */
  6. /*================================================================
  7. Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
  8. Quectel Wireless Solution Proprietary and Confidential.
  9. =================================================================*/
  10. /*=================================================================
  11. EDIT HISTORY FOR MODULE
  12. This section contains comments describing changes made to the module.
  13. Notice that changes are listed in reverse chronological order.
  14. WHEN WHO WHAT, WHERE, WHY
  15. ------------ ------- -------------------------------------------------------------------------------
  16. =================================================================*/
  17. #ifndef QUEC_LOG_H
  18. #define QUEC_LOG_H
  19. #include "osi_log.h"
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. #define QUEC_LOG_LEVEL OSI_LOG_LEVEL_INFO
  24. #define QUEC_LOG_TAG OSI_MAKE_LOG_TAG('Q', 'U', 'E', 'C')
  25. #define QUEC_LOG_TAG_QVOICECALL OSI_MAKE_LOG_TAG('Q', 'V', 'C', 'A')
  26. #define QUEC_LOG_TAG_QATNW OSI_MAKE_LOG_TAG('Q', 'A', 'N', 'W')
  27. #define QUEC_LOG_TAG_QPBK OSI_MAKE_LOG_TAG('Q', 'P', 'B', 'K')
  28. #define QUEC_LOG_TAG_QCFG OSI_MAKE_LOG_TAG('Q', 'C', 'F', 'G')
  29. #define QUEC_LOG_TAG_QATSIM OSI_MAKE_LOG_TAG('Q', 'S', 'I', 'M')
  30. #define QUEC_LOG_TAG_MODEM OSI_MAKE_LOG_TAG('Q', 'M', 'D', 'M')
  31. #define QUEC_LOG_TAG_SDMMC OSI_MAKE_LOG_TAG('Q', 'S', 'D', 'M')
  32. #define QUEC_LOG_TAG_AUDIO OSI_MAKE_LOG_TAG('Q', 'A', 'D', 'O')
  33. #define QUEC_LOG_TAG_GNSS OSI_MAKE_LOG_TAG('Q', 'G', 'N', 'S')
  34. #define QUEC_LOG_TAG_OSI OSI_MAKE_LOG_TAG('Q', 'O', 'S', 'I')
  35. #define QUEC_LOG_TAG_QXRTK OSI_MAKE_LOG_TAG('Q', 'X', 'R', 'T')
  36. #define QUEC_LOG_TAG_CAMERA OSI_MAKE_LOG_TAG('Q', 'C', 'A', 'M')
  37. #define QUEC_LOG_TAG_FTP OSI_MAKE_LOG_TAG('Q', 'F', 'T', 'P')
  38. #define QUEC_LOG_TAG_HTTP OSI_MAKE_LOG_TAG('Q', 'H', 'T', 'T')
  39. #define QUEC_LOG_TAG_MQTT OSI_MAKE_LOG_TAG('Q', 'M', 'Q', 'T')
  40. #define QUEC_LOG_TAG_SMTP OSI_MAKE_LOG_TAG('Q', 'S', 'M', 'T')
  41. #define QUEC_LOG_TAG_ZIP OSI_MAKE_LOG_TAG('Q', 'Z', 'I', 'P')
  42. #define QUEC_LOG_TAG_MMS OSI_MAKE_LOG_TAG('Q', 'M', 'M', 'S')
  43. #define QUEC_LOG_TAG_NTP OSI_MAKE_LOG_TAG('Q', 'N', 'T', 'P')
  44. #define QUEC_LOG_TAG_PING OSI_MAKE_LOG_TAG('Q', 'P', 'I', 'N')
  45. #define QUEC_LOG_TAG_FILE OSI_MAKE_LOG_TAG('Q', 'F', 'I', 'L')
  46. #define QUEC_LOG_TAG_SECURTY OSI_MAKE_LOG_TAG('Q', 'S', 'E', 'C')
  47. #define QUEC_LOG_TAG_ALIYUN_IOT_SMARTCARD OSI_MAKE_LOG_TAG('Q', 'A', 'L', 'S')
  48. #define QUEC_LOG_TAG_ALIPAY_IOT OSI_MAKE_LOG_TAG('Q', 'A', 'L', 'P')
  49. #define QUEC_LOG_TAG_FIREWALL OSI_MAKE_LOG_TAG('Q', 'F', 'I', 'W')
  50. #define QUEC_LOG_TAG_HW_IOT_DEVICE OSI_MAKE_LOG_TAG('Q', 'H', 'W', 'D')
  51. #define QUEC_LOG_TAG_TCPIP OSI_MAKE_LOG_TAG('Q', 'T', 'I', 'P')
  52. #define QUEC_LOG_TAG_LWM2M OSI_MAKE_LOG_TAG('Q', 'M', '2', 'M')
  53. #define QUEC_LOG_TAG_CTSREG OSI_MAKE_LOG_TAG('Q', 'C', 'T', 'R')
  54. #define QUEC_LOG_TAG_LBS OSI_MAKE_LOG_TAG('Q', 'L', 'B', 'S')
  55. #define QUEC_LOG_TAG_POWER OSI_MAKE_LOG_TAG('Q', 'P', 'W', 'R')
  56. #define QUEC_LOG_TAG_URC OSI_MAKE_LOG_TAG('Q', 'U', 'R', 'C')
  57. #define QUEC_LOG_TAG_NOR_FLASH OSI_MAKE_LOG_TAG('Q', 'N', 'O', 'F')
  58. #define QUEC_LOG_TAG_NAND_FLASH OSI_MAKE_LOG_TAG('Q', 'N', 'A', 'F')
  59. #define QUEC_LOG_TAG_PWM OSI_MAKE_LOG_TAG('Q', 'P', 'W', 'M')
  60. #define QUEC_LOG_TAG_CMUX OSI_MAKE_LOG_TAG('Q', 'C', 'M', 'X')
  61. #define QUEC_LOG_TAG_GPIO OSI_MAKE_LOG_TAG('Q', 'G', 'I', 'O')
  62. #define QUEC_LOG_TAG_LED OSI_MAKE_LOG_TAG('Q', 'L', 'E', 'D')
  63. #define QUEC_LOG_TAG_TTS OSI_MAKE_LOG_TAG('Q', 'T', 'T', 'S')
  64. #ifndef _THIS_IP_
  65. //获取当前函数的地址
  66. #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
  67. #endif
  68. extern bool ql_quec_trace_is_enabled(void);
  69. #define QUEC_LOG_PRINTF_TAG(level, tag, fmt, ...) \
  70. do \
  71. { \
  72. if (QUEC_LOG_LEVEL >= level && ql_quec_trace_is_enabled()) \
  73. osiTracePrintf((level << 28) | (tag), fmt, ##__VA_ARGS__); \
  74. } while (0)
  75. #define QUEC_LOG_PRINTF(level, fmt, ...) QUEC_LOG_PRINTF_TAG(level, QUEC_LOG_TAG, fmt, ##__VA_ARGS__)
  76. //log打印加上函数名和行号
  77. //#define custom_log(user_str, msg, ...) QUEC_LOG_PRINTF(QUEC_LOG_LEVEL, "%s %d "msg"", __FUNCTION__, __LINE__, ##__VA_ARGS__)
  78. //#define custom_log_level(level, user_str, msg, ...) QUEC_LOG_PRINTF(level, "%s %d "msg"", __FUNCTION__, __LINE__, ##__VA_ARGS__)
  79. //log打印加上函数地址和行号
  80. #define custom_log(user_str, msg, ...) QUEC_LOG_PRINTF_TAG(QUEC_LOG_LEVEL, QUEC_LOG_TAG, "%p %d "msg"", _THIS_IP_, __LINE__, ##__VA_ARGS__)
  81. #define custom_log_level(level, user_str, msg, ...) QUEC_LOG_PRINTF_TAG(level, QUEC_LOG_TAG, "%p %d "msg"", _THIS_IP_, __LINE__, ##__VA_ARGS__)
  82. #define custom_log_tag(user_str, tag, msg, ...) QUEC_LOG_PRINTF_TAG(QUEC_LOG_LEVEL, tag, "%p %d "msg"", _THIS_IP_, __LINE__, ##__VA_ARGS__)
  83. #define custom_log_level_tag(level, tag, user_str, msg, ...) QUEC_LOG_PRINTF_TAG(level, tag, "%p %d "msg"", _THIS_IP_, __LINE__, ##__VA_ARGS__)
  84. //log打印加上函数地址
  85. //#define custom_log(user_str, msg, ...) QUEC_LOG_PRINTF(QUEC_LOG_LEVEL, "%p "msg"", _THIS_IP_, ##__VA_ARGS__)
  86. //#define custom_log_level(level, user_str, msg, ...) QUEC_LOG_PRINTF(level, "%p "msg"", _THIS_IP_, ##__VA_ARGS__)
  87. #ifdef __cplusplus
  88. } /*"C" */
  89. #endif
  90. #endif /* QUEC_LOG_H */