修改日志初始化值,level值不被覆盖
This commit is contained in:
1 parent
4fe68183ba
commit
faa8de7dc2
3 files changed
+7
-7
No files matched your search
+3
-3
@@ -27,7 +27,7 @@ func (e *Api) Error(c *gin.Context, code int, err error, msg string) {
|
||||
res.Msg = msg
|
||||
}
|
||||
res.RequestId = tools.GenerateMsgIDFromContext(c)
|
||||
c.JSON(http.StatusOK, res.ReturnError(code))
|
||||
c.AbortWithStatusJSON(http.StatusOK, res.ReturnError(code))
|
||||
}
|
||||
|
||||
// OK 通常成功数据处理
|
||||
@@ -38,7 +38,7 @@ func (e *Api) OK(c *gin.Context, data interface{}, msg string) {
|
||||
res.Msg = msg
|
||||
}
|
||||
res.RequestId = tools.GenerateMsgIDFromContext(c)
|
||||
c.JSON(http.StatusOK, res.ReturnOK())
|
||||
c.AbortWithStatusJSON(http.StatusOK, res.ReturnOK())
|
||||
}
|
||||
|
||||
// PageOK 分页数据处理
|
||||
@@ -53,5 +53,5 @@ func (e *Api) PageOK(c *gin.Context, result interface{}, count int, pageIndex in
|
||||
|
||||
// Custom 兼容函数
|
||||
func (e *Api) Custom(c *gin.Context, data gin.H) {
|
||||
c.JSON(http.StatusOK, data)
|
||||
c.AbortWithStatusJSON(http.StatusOK, data)
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@ package logger
|
||||
|
||||
var (
|
||||
// Default logger
|
||||
DefaultLogger Logger = NewHelper(NewLogger())
|
||||
DefaultLogger Logger
|
||||
)
|
||||
|
||||
// Logger is a generic logging interface
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@ func Error(c *gin.Context, code int, err error, msg string) {
|
||||
res.Msg = msg
|
||||
}
|
||||
res.RequestId = tools.GenerateMsgIDFromContext(c)
|
||||
c.JSON(http.StatusOK, res.ReturnError(code))
|
||||
c.AbortWithStatusJSON(http.StatusOK, res.ReturnError(code))
|
||||
}
|
||||
|
||||
// 通常成功数据处理
|
||||
@@ -29,7 +29,7 @@ func OK(c *gin.Context, data interface{}, msg string) {
|
||||
res.Msg = msg
|
||||
}
|
||||
res.RequestId = tools.GenerateMsgIDFromContext(c)
|
||||
c.JSON(http.StatusOK, res.ReturnOK())
|
||||
c.AbortWithStatusJSON(http.StatusOK, res.ReturnOK())
|
||||
}
|
||||
|
||||
// 分页数据处理
|
||||
@@ -44,5 +44,5 @@ func PageOK(c *gin.Context, result interface{}, count int, pageIndex int, pageSi
|
||||
|
||||
// 兼容函数
|
||||
func Custum(c *gin.Context, data gin.H) {
|
||||
c.JSON(http.StatusOK, data)
|
||||
c.AbortWithStatusJSON(http.StatusOK, data)
|
||||
}
|
||||
Reference in new issue
Block a user