Update and improve logging library to logrus

This commit is contained in:
Nicholas Thompson
2020-06-15 13:28:03 +02:00
parent c459fb22aa
commit 6ab917d35a
5 changed files with 55 additions and 38 deletions

View File

@@ -32,15 +32,17 @@ package webui
import (
"fmt"
"log"
"net/http"
"sync"
"time"
"github.com/diebietse/invertergui/mk2driver"
"github.com/diebietse/invertergui/websocket"
"github.com/sirupsen/logrus"
)
var log = logrus.WithField("ctx", "inverter-gui-webgui")
const (
LedOff = "dot-off"
LedRed = "dot-red"
@@ -169,7 +171,7 @@ func (w *WebGui) dataPoll() {
if s.Valid {
err := w.hub.Broadcast(buildTemplateInput(s))
if err != nil {
log.Printf("Could not send update to clients: %v", err)
log.Errorf("Could not send update to clients: %v", err)
}
}
case <-w.stopChan: