This commit is contained in:
J. Nick Koston
2026-01-05 15:11:01 -10:00
parent 21b0955d4f
commit 327458169c
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -172,7 +172,7 @@ class Logger : public Component {
#ifdef USE_ESPHOME_TASK_LOG_BUFFER
void init_log_buffer(size_t total_buffer_size);
#endif
#if defined(USE_ESPHOME_TASK_LOG_BUFFER) || (defined(USE_ZEPHYR) && defined(USE_LOGGER_USB_CDC)) || defined(USE_HOST)
#if defined(USE_ESPHOME_TASK_LOG_BUFFER) || (defined(USE_ZEPHYR) && defined(USE_LOGGER_USB_CDC))
void loop() override;
#endif
/// Manually set the baud rate for serial, set to 0 to disable.
@@ -22,10 +22,14 @@ button:
static void *thread_func(void *arg) {
int thread_id = *static_cast<int *>(arg);
// Set thread name (macOS only takes 1 arg)
// Set thread name (different signatures on macOS vs Linux)
char thread_name[16];
snprintf(thread_name, sizeof(thread_name), "LogThread%d", thread_id);
#ifdef __APPLE__
pthread_setname_np(thread_name);
#else
pthread_setname_np(pthread_self(), thread_name);
#endif
// Log messages with different log levels
for (int i = 0; i < MESSAGES_PER_THREAD; i++) {