1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 00:31:58 +00:00
This commit is contained in:
Jonathan Swoboda
2025-12-01 23:32:36 -05:00
parent fa2d206d74
commit 629ebdd794

View File

@@ -114,11 +114,15 @@ FILTER_PLATFORMIO_LINES = [
class PlatformioLogFilter(logging.Filter):
"""Filter to suppress noisy platformio log messages."""
_PATTERN = re.compile(
r"|".join(r"(?:" + pattern + r")" for pattern in FILTER_PLATFORMIO_LINES)
)
def filter(self, record: logging.LogRecord) -> bool:
# Only filter messages from platformio-related loggers
if "platformio" not in record.name.lower():
return True
return not any(msg in record.getMessage() for msg in FILTER_PLATFORMIO_LINES)
return self._PATTERN.match(record.getMessage()) is None
def patch_platformio_logging() -> None: