diff options
author | Jonas Smedegaard <dr@jones.dk> | 2025-04-15 12:02:50 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2025-04-15 12:04:34 +0200 |
commit | 818722baf294c9f7d1b9422bf1f2a3066cb2c9cf (patch) | |
tree | f2a8436eddb38a8b78914bb5e6ff7057bc96ddf6 /sensor/mylog.h | |
parent | 2b55b35b3be6b42400359f6e816705efc530508a (diff) |
add sensor as non-library sketch
Diffstat (limited to 'sensor/mylog.h')
-rw-r--r-- | sensor/mylog.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sensor/mylog.h b/sensor/mylog.h new file mode 100644 index 0000000..43e3c91 --- /dev/null +++ b/sensor/mylog.h @@ -0,0 +1,37 @@ +/* +Origin: https://forum.arduino.cc/t/esp-log-level-set-is-not-working/1298369/5 + +Changes 2025-04-15 by Jonas Smedegaard <dr@jones.dk>: + * adjust ARDUHAL_LOG_FORMAT to include letter and newline +*/ + +#ifndef MYLOG_H +#define MYLOG_H + +// Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.1-632e0c2a/esp32/include/log/include/ +#include <esp_log.h> +// Library/Arduino15/packages/esp32/hardware/esp32/3.0.7/cores/esp32/esp32-hal-log.h +#include <esp32-hal-log.h> + + +#undef CONFIG_LOG_MAXIMUM_LEVEL +#define CONFIG_LOG_MAXIMUM_LEVEL CORE_DEBUG_LEVEL + +#undef ESP_LOGE +#undef ESP_LOGW +#undef ESP_LOGI +#undef ESP_LOGD +#undef ESP_LOGV + +#define ESP_LOGE( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_ERROR, tag, ARDUHAL_LOG_FORMAT(E, format) __VA_OPT__(,) __VA_ARGS__) +#define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, ARDUHAL_LOG_FORMAT(W, format) __VA_OPT__(,) __VA_ARGS__) +#define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, ARDUHAL_LOG_FORMAT(I, format) __VA_OPT__(,) __VA_ARGS__) +#define ESP_LOGD( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_DEBUG, tag, ARDUHAL_LOG_FORMAT(D, format) __VA_OPT__(,) __VA_ARGS__) +#define ESP_LOGV( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_VERBOSE, tag, ARDUHAL_LOG_FORMAT(V, format) __VA_OPT__(,) __VA_ARGS__) + +#undef ARDUHAL_LOG_FORMAT +#define ARDUHAL_LOG_FORMAT(letter, format) \ + ARDUHAL_LOG_COLOR_##letter "[" #letter "] %s(): " format ARDUHAL_LOG_RESET_COLOR "\r\n", \ + __FUNCTION__ + +#endif // MYLOG_H |