Skip to content

Commit 51c09ed

Browse files
authored
Fix esp32 log level and improve logging tag names (#10)
- Sets the component log level (local to this component) to debug so that the microDecoder log messages show up in ESPHome - Changes the file log tag to follow the ``micro_decoder.*`` scheme
1 parent e36134a commit 51c09ed

6 files changed

Lines changed: 12 additions & 5 deletions

File tree

cmake/esp-idf.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ function(micro_decoder_configure_esp_idf TARGET_LIB COMPONENT_DIR)
99
-Wnon-virtual-dtor
1010
)
1111

12+
# Enable debug-level logging for this library regardless of ESP-IDF's global default.
13+
# ESP-IDF defaults to ERROR in ESPHome, which compiles out all INFO/DEBUG/WARN logs.
14+
# LOG_LOCAL_LEVEL overrides the compile-time maximum for this component only.
15+
target_compile_definitions(${TARGET_LIB} PRIVATE
16+
LOG_LOCAL_LEVEL=ESP_LOG_DEBUG
17+
)
18+
1219
# =========================================================================
1320
# Codec options: translate Kconfig to compiler defines
1421
# =========================================================================

src/audio_decoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
namespace micro_decoder {
2222

23-
static constexpr const char* TAG = "audio_decoder";
23+
static constexpr const char* TAG = "micro_decoder.audio_decoder";
2424

2525
static constexpr uint32_t MAX_POTENTIALLY_FAILED_COUNT = 10;
2626
static constexpr uint32_t READ_TIMEOUT_MS = 20;

src/audio_reader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace micro_decoder {
2222
// Static constants
2323
// ============================================================================
2424

25-
static constexpr const char* TAG = "audio_reader";
25+
static constexpr const char* TAG = "micro_decoder.audio_reader";
2626

2727
// ============================================================================
2828
// AudioReader

src/decoder_source.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
namespace micro_decoder {
2828

29-
static constexpr const char* TAG = "decoder_source";
29+
static constexpr const char* TAG = "micro_decoder.decoder_source";
3030

3131
// ============================================================================
3232
// Event flag bits

src/esp/http_client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
namespace micro_decoder {
2828

29-
static constexpr const char* TAG = "http_client";
29+
static constexpr const char* TAG = "micro_decoder.http_client";
3030

3131
static constexpr uint8_t MAX_REDIRECTIONS = 5;
3232
static constexpr uint8_t MAX_HEADER_ATTEMPTS = 6;

src/host/http_client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
namespace micro_decoder {
2929

30-
static constexpr const char* TAG = "http_client";
30+
static constexpr const char* TAG = "micro_decoder.http_client";
3131

3232
static constexpr size_t CURL_BUFFER_SIZE = 32UL * 1024UL;
3333
static constexpr int POLL_TIMEOUT_MS = 100;

0 commit comments

Comments
 (0)