From abcbdece2e739c9ae64f9f69924cc230629de929 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 3 Oct 2025 00:33:03 +0200 Subject: [PATCH] handle >999 --- esphome/components/logger/logger.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/esphome/components/logger/logger.h b/esphome/components/logger/logger.h index 2f12124217..f0e0ed9a27 100644 --- a/esphome/components/logger/logger.h +++ b/esphome/components/logger/logger.h @@ -356,12 +356,11 @@ class Logger : public Component { copy_string(buffer, pos, tag); buffer[pos++] = ':'; // Format line number without modulo operations (passed by value, safe to mutate) - if [[unlikely]] - (line > 999) { - int thousands = line / 1000; - buffer[pos++] = '0' + thousands; - line -= thousands * 1000; - } + if (line > 999) [[unlikely]] { + int thousands = line / 1000; + buffer[pos++] = '0' + thousands; + line -= thousands * 1000; + } int hundreds = line / 100; int remainder = line - hundreds * 100; int tens = remainder / 10;