log: define LOG_LOCAL_LEVEL before using it, don't use type cast

LOG_LOCAL_LEVEL is now used in a construct like:
 #if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO)
Make sure that LOG_LOCAL_LEVEL is defined, and don't use a type cast in
its definition, because preprocessor can not parse that.
This commit is contained in:
Ivan Grokhotkov 2018-01-05 12:57:35 +08:00
parent 30aacb79d5
commit 6a5c105753

View file

@ -100,6 +100,14 @@ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, .
#include "esp_log_internal.h"
#ifndef LOG_LOCAL_LEVEL
#ifndef BOOTLOADER_BUILD
#define LOG_LOCAL_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#else
#define LOG_LOCAL_LEVEL CONFIG_LOG_BOOTLOADER_LEVEL
#endif
#endif
/**
* @brief Log a buffer of hex bytes at specified level, seprated into 16 bytes each line.
*
@ -219,14 +227,6 @@ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, .
#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%d) %s: " format LOG_RESET_COLOR "\n"
#ifndef LOG_LOCAL_LEVEL
#ifndef BOOTLOADER_BUILD
#define LOG_LOCAL_LEVEL ((esp_log_level_t) CONFIG_LOG_DEFAULT_LEVEL)
#else
#define LOG_LOCAL_LEVEL ((esp_log_level_t) CONFIG_LOG_BOOTLOADER_LEVEL)
#endif
#endif
/// macro to output logs in startup code, before heap allocator and syscalls have been initialized. log at ``ESP_LOG_ERROR`` level. @see ``printf``,``ESP_LOGE``
#define ESP_EARLY_LOGE( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) { ets_printf(LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
/// macro to output logs in startup code at ``ESP_LOG_WARN`` level. @see ``ESP_EARLY_LOGE``,``ESP_LOGE``, ``printf``