feat : Log optimization

This commit is contained in:
zhangwenjian committed 2020-07-27 22:43:17 +08:00
1 parent f3a425a82b
commit 22124b236a
4 files changed
+36 -10

No files matched your search

+2 -2
View File
@@ -88,14 +88,14 @@ func Authenticator(c *gin.Context) (interface{}, error) {
msg = "登录失败"
status = "1"
LoginLogToDB(c, status, msg, username)
global.AccessLogger.Println(e.Error())
global.RequestLogger.Println(e.Error())
}
return nil, jwt.ErrFailedAuthentication
}
// Write log to database
func LoginLogToDB(c *gin.Context, status string, msg string, username string) {
if config.LoggerConfig.Enabled {
if config.LoggerConfig.EnabledDB {
var loginlog models.LoginLog
ua := user_agent.New(c.Request.UserAgent())
loginlog.Ipaddr = c.ClientIP()