]> granicus.if.org Git - esp-idf/commitdiff
log: define LOG_LOCAL_LEVEL before using it, don't use type cast
authorIvan Grokhotkov <ivan@espressif.com>
Fri, 5 Jan 2018 04:57:35 +0000 (12:57 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Fri, 5 Jan 2018 08:10:58 +0000 (16:10 +0800)
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.

components/log/include/esp_log.h

index e525bca3c0a042557ed3055279c84d6b80da6629..30e406247528fef88f124697c2216b283be04150 100644 (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``