Fix debug log spam by gating debug logs with config.debuglogging
Some checks failed
Release Drafter / update_release_draft (push) Failing after 4s

- Added config.debuglogging check to 'Found listening connection' debug log
- Added config.debuglogging check to 'Hass WS Disconnected' debug log
- Prevents log spam when debuglogging is disabled (default)
- Fixes issue causing multi-GB log files from frequent state change events
This commit is contained in:
Clawd
2026-02-23 19:54:06 +00:00
parent 9ba31cbafe
commit a2955ceab4

View File

@@ -229,7 +229,9 @@ function onStateChangedEvent(event) {
} }
for (const connection in this.connections) { for (const connection in this.connections) {
if (this.connections[connection].entities.includes(event.data.entity_id)) { if (this.connections[connection].entities.includes(event.data.entity_id)) {
if (config.debuglogging) {
this.logger.debug(`Found listening connection (${connection}) for entity ${event.data.entity_id}`); this.logger.debug(`Found listening connection (${connection}) for entity ${event.data.entity_id}`);
}
this.sendSocketNotification("CHANGED_STATE", { this.sendSocketNotification("CHANGED_STATE", {
identifier: connection, identifier: connection,
cause: event.data.entity_id, cause: event.data.entity_id,
@@ -241,7 +243,9 @@ function onStateChangedEvent(event) {
function onWebsocketCloseEvent(event) { function onWebsocketCloseEvent(event) {
for (const connection in this.connections) { for (const connection in this.connections) {
if (event.target == this.connections[connection].websocket.rawClient.ws) { if (event.target == this.connections[connection].websocket.rawClient.ws) {
if (config.debuglogging) {
this.logger.debug(`Hass WS Disconnected (${connection})`); this.logger.debug(`Hass WS Disconnected (${connection})`);
}
this.sendSocketNotification("HASSWS_DISCONNECTED", { this.sendSocketNotification("HASSWS_DISCONNECTED", {
identifier: connection, identifier: connection,
}); });