diff --git a/cores/esp32/esp32-hal-log.h b/cores/esp32/esp32-hal-log.h
index e3ff5e77044..43d84a40ba6 100644
--- a/cores/esp32/esp32-hal-log.h
+++ b/cores/esp32/esp32-hal-log.h
@@ -38,9 +38,11 @@ extern "C"
 #else
 #define ARDUHAL_LOG_LEVEL CORE_DEBUG_LEVEL
 #ifdef USE_ESP_IDF_LOG
+#ifndef LOG_LOCAL_LEVEL
 #define LOG_LOCAL_LEVEL CORE_DEBUG_LEVEL
 #endif
 #endif
+#endif
 
 #ifndef CONFIG_ARDUHAL_LOG_COLORS
 #define CONFIG_ARDUHAL_LOG_COLORS 0