feat: implement centralized logging helper
- remove direct log usage
- create a new logging helper
- update all log calls to use the new Logger instance
- set timestamp to ISO8601
🤖
This commit is contained in:
parent
ebc81657f5
commit
561419b568
6 changed files with 24 additions and 14 deletions
|
@ -2,9 +2,9 @@ package websocket
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/charmbracelet/log"
|
||||
"github.com/gorilla/websocket"
|
||||
|
||||
"git.smsvc.net/pomodoro/ChronoTomato/internal/helper"
|
||||
GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
||||
)
|
||||
|
||||
|
@ -12,13 +12,13 @@ import (
|
|||
func sendClientCommand(c Client, msg GoTomato.ClientCommand) {
|
||||
messageBytes, err := json.Marshal(msg)
|
||||
if err != nil {
|
||||
log.Error("Error marshalling!", "reason", err)
|
||||
helper.Logger.Error("Error marshalling!", "reason", err)
|
||||
return
|
||||
}
|
||||
|
||||
err = c.Conn.WriteMessage(websocket.TextMessage, messageBytes)
|
||||
if err != nil {
|
||||
log.Error("Write error!", "reason", err)
|
||||
helper.Logger.Error("Write error!", "reason", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue