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,12 +1,12 @@
|
|||
package websocket
|
||||
|
||||
import (
|
||||
"github.com/charmbracelet/log"
|
||||
"github.com/gorilla/websocket"
|
||||
"net"
|
||||
"net/http"
|
||||
"sync"
|
||||
|
||||
"git.smsvc.net/pomodoro/GoTomato/internal/helper"
|
||||
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
||||
)
|
||||
|
||||
|
@ -24,7 +24,7 @@ func HandleConnection(w http.ResponseWriter, r *http.Request) {
|
|||
// Upgrade initial GET request to a WebSocket
|
||||
ws, err := upgrader.Upgrade(w, r, nil)
|
||||
if err != nil {
|
||||
log.Error("WebSocket upgrade error:", "msg", err)
|
||||
helper.Logger.Error("WebSocket upgrade error:", "msg", err)
|
||||
return
|
||||
}
|
||||
defer ws.Close()
|
||||
|
@ -38,7 +38,7 @@ func HandleConnection(w http.ResponseWriter, r *http.Request) {
|
|||
Clients[ws.LocalAddr()] = &client
|
||||
mu.Unlock()
|
||||
|
||||
log.Info("Client connected", "host", client.RealIP, "clients", len(Clients))
|
||||
helper.Logger.Info("Client connected", "host", client.RealIP, "clients", len(Clients))
|
||||
|
||||
// Listen for commands from the connected client
|
||||
handleClientCommands(client)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue