Upgraded to go1.22 + replaced log with slog
This commit is contained in:
1 parent
67c72e8b4f
commit
b4288b2abb
9 files changed
+97
-43
No files matched your search
+2
-3
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user