Add filename and line number back to esp log

This commit is contained in:
2025-06-24 17:37:03 +02:00
parent 54a30ad090
commit bc508769d4
2 changed files with 6 additions and 2 deletions

View File

@ -19,7 +19,7 @@ extern "C" {
#include "core_dump_checksum.h"
#if CONFIG_ESP_COREDUMP_LOGS
#define ESP_COREDUMP_LOG( level, format, ... ) if (LOG_LOCAL_LEVEL >= level) { esp_rom_printf((format), esp_log_early_timestamp(), (const char *)TAG, ##__VA_ARGS__); }
#define ESP_COREDUMP_LOG( level, format, ... ) if (LOG_LOCAL_LEVEL >= level) { esp_rom_printf(format, esp_log_early_timestamp(), (const char *)TAG, ##__VA_ARGS__); }
#else
#define ESP_COREDUMP_LOG( level, format, ... ) // dummy define doing nothing
#endif

View File

@ -11,8 +11,12 @@ extern "C" {
#endif
/** @cond */
#define ESP_LOG_STRINGIFY2(x) #x
#define ESP_LOG_STRINGIFY(x) ESP_LOG_STRINGIFY2(x)
// For backward compatibility (these macros are not used in the log v2).
#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n"
#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " %s:" ESP_LOG_STRINGIFY(__LINE__) " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n", (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
#define _ESP_LOG_DRAM_LOG_FORMAT(letter, format) DRAM_STR(#letter " %s: " format "\n")
#define LOG_SYSTEM_TIME_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%s) %s: " format LOG_RESET_COLOR "\n"
/** @endcond */