Log error in la.go if unable to open file
This commit is contained in:
@@ -2,6 +2,7 @@ package lib
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/shirou/gopsutil/load"
|
||||
@@ -22,7 +23,13 @@ func (c *MyConfig) UpdateLaStats() {
|
||||
ticker.Reset(Delay)
|
||||
}
|
||||
|
||||
l, _ := load.Avg()
|
||||
l, err := load.Avg()
|
||||
|
||||
if err != nil {
|
||||
log.Printf("Unable to get LA stats: %s", err)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
lav := fmt.Sprintf("%.2f", l.Load1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user