diff --git a/CHANGELOG.md b/CHANGELOG.md index 53b5a2c3..b5ae31c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - There were a number of minor issues with the config file that have been cleaned up. - Compile errors on FreeBSD due to golang.org/x/sys API breakages - Key bindings now work in FreeBSD (#95) +- Only report battery sensor errors once (reduce noise in the log, #117) ## [3.5.3] - 2020-05-30 diff --git a/widgets/batterygauge.go b/widgets/batterygauge.go index f28dd34a..135f2231 100644 --- a/widgets/batterygauge.go +++ b/widgets/batterygauge.go @@ -39,11 +39,16 @@ func (b *BatteryGauge) EnableMetric() { }) } +// Only report battery errors once. +var errLogged = false + func (b *BatteryGauge) update() { - // FIXME: Getting a lot of these in the logs bats, err := battery.GetAll() if err != nil { - log.Printf("error setting up batteries: %v", err) + if !errLogged { + log.Printf("error setting up batteries: %v", err) + errLogged = true + } return } mx := 0.0