💄 Fixes logs

This commit is contained in:
Daniel Svitan 2025-03-22 13:51:25 +01:00
parent 2502d8715a
commit 877df49f80

View File

@ -146,7 +146,7 @@ func keys(c echo.Context) error {
}
clients = append(clients, &client)
id += 1
fmt.Printf("%s client %-3d connected", time.Now().Format(TimeFormat), client.ID)
fmt.Printf("%s client %-3d connected\n", time.Now().Format(TimeFormat), client.ID)
err = ws.WriteMessage(websocket.TextMessage, []byte("welcome"))
if err != nil {
@ -156,7 +156,7 @@ func keys(c echo.Context) error {
f, err := os.OpenFile(fmt.Sprintf("%s/%s_%d.txt", keyDir, time.Now().Format("2006-01-02_15-04"), client.ID), syscall.O_CREAT|syscall.O_APPEND|syscall.O_WRONLY, 0644)
if err != nil {
log.Error(err)
fmt.Printf("%s client %-3d crashed (couldn't open file)", time.Now().Format(TimeFormat), client.ID)
fmt.Printf("%s client %-3d crashed (couldn't open file)\n", time.Now().Format(TimeFormat), client.ID)
client.Exit = true
return c.NoContent(http.StatusInternalServerError)
}
@ -171,7 +171,7 @@ func keys(c echo.Context) error {
for {
if client.Exit {
close()
fmt.Printf("%s client %-3d disconnected", time.Now().Format(TimeFormat), client.ID)
fmt.Printf("%s client %-3d disconnected\n", time.Now().Format(TimeFormat), client.ID)
break
}
@ -179,7 +179,7 @@ func keys(c echo.Context) error {
if err != nil {
log.Error(err)
close()
fmt.Printf("%s client %-3d crashed (websocket error)", time.Now().Format(TimeFormat), client.ID)
fmt.Printf("%s client %-3d crashed (websocket error)\n", time.Now().Format(TimeFormat), client.ID)
break
}
@ -187,7 +187,7 @@ func keys(c echo.Context) error {
if err != nil {
log.Error(err)
close()
fmt.Printf("%s client %-3d crashed (file write error)", time.Now().Format(TimeFormat), client.ID)
fmt.Printf("%s client %-3d crashed (file write error)\n", time.Now().Format(TimeFormat), client.ID)
break
}