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 0732d6f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion custom_components/hass_diagnostics/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0732d6f

Please sign in to comment.