ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers baidu_iot_ota_log.h Source File

baidu_iot_ota_log.h

00001 #pragma once
00002 #include <stdio.h>
00003 
00004 #define DEBUG_LEVEL_INF    3
00005 #define DEBUG_LEVEL_DBG    2
00006 #define DEBUG_LEVEL_WRN    1
00007 #define DEBUG_LEVEL_ERR    0
00008 #define OTA_DEBUG_LEVEL    DEBUG_LEVEL_ERR
00009 
00010 #define OTA_LOG(format, level, ...) do \
00011                                     { \
00012                                                                             if (OTA_DEBUG_LEVEL >= level) \
00013                                                                                 { \
00014                                                                                       printf("%s:%s: "format, __FILE__, __FUNCTION__, ##__VA_ARGS__); \
00015                                                                                 } \
00016                                                                         }while(0);
00017 
00018 #define OTA_LOG_INFO(format, ...) OTA_LOG(format, DEBUG_LEVEL_INF, __VA_ARGS__)
00019 #define OTA_LOG_DBG(format, ...)  OTA_LOG(format, DEBUG_LEVEL_DBG, __VA_ARGS__)
00020 #define OTA_LOG_WARN(format, ...) OTA_LOG(format, DEBUG_LEVEL_WRN, __VA_ARGS__)
00021 #define OTA_LOG_ERR(format, ...)  OTA_LOG(format, DEBUG_LEVEL_ERR, __VA_ARGS__)
00022 
00023 #define OTA_FUNC_ENTER() OTA_LOG_INFO("enter %s:%s\n", __FILE__, __FUNCTION__)
00024 #define OTA_FUNC_LEAVE() OTA_LOG_INFO("leave %s:%s\n", __FILE__, __FUNCTION__)