Use the out.Write to write the log content immediately, because the LogFormatter returns a string, the fmt.Fprint is unnecessary here

This commit is contained in:
mstmdev 2022-01-07 00:22:28 +08:00
parent 94153d1e19
commit 8eb474c0ab

View File

@ -6,6 +6,7 @@ package gin
import ( import (
"fmt" "fmt"
"github.com/gin-gonic/gin/internal/bytesconv"
"io" "io"
"net/http" "net/http"
"os" "os"
@ -264,7 +265,7 @@ func LoggerWithConfig(conf LoggerConfig) HandlerFunc {
param.Path = path param.Path = path
fmt.Fprint(out, formatter(param)) out.Write(bytesconv.StringToBytes(formatter(param)))
} }
} }
} }