Added more debugging output and microsecond log timestamps

This commit is contained in:
Darell Tan
2026-01-12 23:17:02 +08:00
parent c2da4ca2eb
commit 93a8d59cd9

View File

@@ -189,6 +189,9 @@ func (br *Bridge) StartHAP() error {
if br.DebugMode { if br.DebugMode {
haplog.Debug.Enable() haplog.Debug.Enable()
// add microseconds to log output
log.SetFlags(log.LstdFlags | log.Lmicroseconds)
} }
err = br.server.ListenAndServe(br.ctx) err = br.server.ListenAndServe(br.ctx)
@@ -579,11 +582,17 @@ wait:
// updatedVal is float64 coz that's how Z2M JSON values are, but expVal may not be // updatedVal is float64 coz that's how Z2M JSON values are, but expVal may not be
mapping.ExposesEntry.Type == "numeric" && cmpFloat64Numeric(updatedVal, expVal) { mapping.ExposesEntry.Type == "numeric" && cmpFloat64Numeric(updatedVal, expVal) {
if br.DebugMode {
log.Printf("Z2M state %q for %s updated to %q", prop, key, updatedVal)
}
updated = true updated = true
break wait break wait
} }
case <-ctx.Done(): case <-ctx.Done():
if br.DebugMode {
log.Printf("Z2M state update %s timed out", key)
}
break wait break wait
} }
} }