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:
Sebastian Mark 2024-11-03 22:22:03 +01:00
parent ebc81657f5
commit 561419b568
6 changed files with 24 additions and 14 deletions

View file

@ -1,10 +1,10 @@
package websocket
import (
"github.com/charmbracelet/log"
"github.com/gorilla/websocket"
"time"
"git.smsvc.net/pomodoro/ChronoTomato/internal/helper"
ChronoTomato "git.smsvc.net/pomodoro/ChronoTomato/pkg/models"
)
@ -14,10 +14,10 @@ type Client ChronoTomato.GoTomatoClient // New websocket client
func Connect(url string) Client {
conn, _, err := websocket.DefaultDialer.Dial(url, nil)
if err != nil {
log.Fatal("Dial error!", "reason", err)
helper.Logger.Fatal("Dial error!", "reason", err)
}
log.Info("Connected 󰖟 ", "host", url)
helper.Logger.Info("Connected 󰖟 ", "host", url)
time.Sleep(time.Second)
return Client{Conn: conn}