From 0732d6fff8db6eabfb49f6359d085eb0d070d743 Mon Sep 17 00:00:00 2001 From: Alex X Date: Sat, 13 Apr 2024 06:02:25 +0300 Subject: [PATCH] Add trace data to record --- custom_components/hass_diagnostics/sensor.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/custom_components/hass_diagnostics/sensor.py b/custom_components/hass_diagnostics/sensor.py index 4137f43..f28f1fd 100644 --- a/custom_components/hass_diagnostics/sensor.py +++ b/custom_components/hass_diagnostics/sensor.py @@ -63,9 +63,17 @@ def emit(self, record: logging.LogRecord, count: int = 1): if item := self.records.get(key): item["count"] += count else: + entry["count"] = count + entry["exception"] = record.exc_text + entry["source"] = [ + record.pathname, + record.lineno, + record.processName, + record.threadName, + record.funcName, + ] if github := github_get_link(record): entry["github"] = github - entry["count"] = count self.records[key] = entry self._attr_native_value += count