Commit
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"nCovTrack-Backend/utils"
|
||||
"net"
|
||||
"net/http"
|
||||
@@ -33,7 +34,7 @@ func GinRecovery(stack bool) gin.HandlerFunc {
|
||||
"error", interface{}(err),
|
||||
)
|
||||
if brokenPipe {
|
||||
utils.RequestLogPanic(logParams...)
|
||||
utils.RequestLogError(logParams...)
|
||||
c.Error(err.(error))
|
||||
c.Abort()
|
||||
return
|
||||
@@ -46,8 +47,9 @@ func GinRecovery(stack bool) gin.HandlerFunc {
|
||||
"stack", string(debug.Stack()),
|
||||
)
|
||||
}
|
||||
utils.RequestLogPanic(logParams...)
|
||||
utils.RequestLogError(logParams...)
|
||||
c.AbortWithStatus(http.StatusInternalServerError)
|
||||
fmt.Printf("\n%s\n", debug.Stack())
|
||||
}
|
||||
}()
|
||||
c.Next()
|
||||
|
||||
@@ -31,7 +31,7 @@ func RequestLog() gin.HandlerFunc {
|
||||
}
|
||||
|
||||
// Log while request cost an unexpected time;
|
||||
if cost >= 800 {
|
||||
if cost.Milliseconds() >= 800 {
|
||||
logParams = append(logParams,
|
||||
"status", c.Writer.Status(),
|
||||
"query", c.Request.URL.Query(),
|
||||
|
||||
Reference in New Issue
Block a user