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
76f3954299
commit
600d2ed2ff
6 changed files with 30 additions and 17 deletions
|
@ -1,8 +1,9 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"github.com/charmbracelet/log"
|
||||
"github.com/gorilla/websocket"
|
||||
|
||||
"git.smsvc.net/pomodoro/GoTomato/internal/helper"
|
||||
)
|
||||
|
||||
// Represents a command from the client (start/stop)
|
||||
|
@ -23,7 +24,7 @@ type WebsocketClient struct {
|
|||
func (c *WebsocketClient) SendMessage(messageType int, data []byte) error {
|
||||
err := c.Conn.WriteMessage(messageType, data)
|
||||
if err != nil {
|
||||
log.Error("Error writing to WebSocket:", "msg", err)
|
||||
helper.Logger.Error("Error writing to WebSocket:", "msg", err)
|
||||
c.Conn.Close() // Close the connection on error
|
||||
}
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue