Skip to content

Commit

Permalink
Add trace data to record
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Apr 13, 2024
1 parent b2f5c81 commit e7787b3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion custom_components/hass_diagnostics/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,18 @@ def emit(self, record: logging.LogRecord, count: int = 1):
if item := self.records.get(key):
item["count"] += count
else:
entry["count"] = count
entry["source"] = [
record.pathname,
record.lineno,
record.processName,
record.threadName,
record.funcName,
]
if record.exc_text:
entry["exception"] = record.exc_text
if github := github_get_link(record):
entry["github"] = github
entry["count"] = count
self.records[key] = entry

self._attr_native_value += count
Expand Down

0 comments on commit e7787b3

Please sign in to comment.