Only report battery sensor errors once; closes #117
This commit is contained in:
parent
e8727c7c20
commit
5123568b92
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user