Upgraded to go1.22 + replaced log with slog

This commit is contained in:
brajkovic committed 2024-04-01 11:09:54 +02:00
1 parent 67c72e8b4f
commit b4288b2abb
9 files changed
+97 -43

No files matched your search

+2 -3
View File
@@ -1,11 +1,10 @@
package api
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"holiday-api/domain/holiday"
"log"
"log/slog"
"net/http"
"strconv"
"time"
@@ -339,7 +338,7 @@ func render(c *gin.Context, status int, response any, contentType *string) {
}
func Abort(c *gin.Context, err error, statusCode int, message string) {
log.Output(1, fmt.Sprintf("error | %s | err: %v", message, errorMessage(err)))
slog.Error(message, slog.String("err", errorMessage(err)))
c.AbortWithError(statusCode, err)
}