feat: replace standard log with charmbracelet/log

- update logging to use charmbracelet/log package
- improve log messages for server start and errors
- enhance client connection and disconnection logs

🤖
This commit is contained in:
Sebastian Mark 2024-10-26 00:01:07 +02:00
parent 3eae584d6d
commit 899417b605
7 changed files with 68 additions and 15 deletions

View file

@ -7,7 +7,7 @@ import (
"git.smsvc.net/pomodoro/GoTomato/internal/shared"
"git.smsvc.net/pomodoro/GoTomato/internal/websocket"
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
"log"
"github.com/charmbracelet/log"
"net/http"
"os"
"strings"
@ -39,9 +39,9 @@ func Start() {
http.HandleFunc("/ws", websocket.HandleConnections)
go websocket.SendPermanentBroadCastMessage()
log.Printf("Pomodoro WebSocket server started on %s\n", listen)
log.Info("Pomodoro WebSocket server started!", "listen", listen)
err := http.ListenAndServe(listen, nil)
if err != nil {
log.Fatalf("Error starting server: %v", err)
log.Fatal("Error starting server:", "msg", err)
}
}