Implement custom logger with log levels

This commit is contained in:
Pijus Kamandulis
2024-02-27 22:38:59 +02:00
parent b9e38575bc
commit 6ccb7c4bdd
13 changed files with 108 additions and 51 deletions

View File

@@ -2,10 +2,10 @@ package middleware
import (
"bytes"
"fmt"
"io"
"github.com/gin-gonic/gin"
"github.com/pikami/cosmium/internal/logger"
)
func RequestLogger() gin.HandlerFunc {
@@ -16,7 +16,7 @@ func RequestLogger() gin.HandlerFunc {
bodyStr := readBody(rdr1)
if bodyStr != "" {
fmt.Println(bodyStr)
logger.Debug(bodyStr)
}
c.Request.Body = rdr2