From 4c767b2f72d0bfd57d353b78486427526ac0f3d2 Mon Sep 17 00:00:00 2001
From: "J. Nick Koston" <nick@koston.org>
Date: Wed, 5 Apr 2023 14:53:19 -1000
Subject: [PATCH] Generate a seperate log message per dumped object for
 profiler.dump_log_objects (#90867)

Since some objects are very large we can generate overly large log messages
```
Event data for system_log_event exceed maximum size of 32768 bytes. This can cause database performance issues; Event data will not be stored
```

Reported in https://ptb.discord.com/channels/330944238910963714/427516175237382144/1093069996101472306
---
 homeassistant/components/profiler/__init__.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/homeassistant/components/profiler/__init__.py b/homeassistant/components/profiler/__init__.py
index 95ce69aed4a..f558b7301c5 100644
--- a/homeassistant/components/profiler/__init__.py
+++ b/homeassistant/components/profiler/__init__.py
@@ -164,11 +164,12 @@ async def async_setup_entry(  # noqa: C901
 
         obj_type = call.data[CONF_TYPE]
 
-        _LOGGER.critical(
-            "%s objects in memory: %s",
-            obj_type,
-            [_safe_repr(obj) for obj in objgraph.by_type(obj_type)],
-        )
+        for obj in objgraph.by_type(obj_type):
+            _LOGGER.critical(
+                "%s object in memory: %s",
+                obj_type,
+                _safe_repr(obj),
+            )
 
         persistent_notification.create(
             hass,
-- 
GitLab