We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在user.go里面给增加user写了一个日志 引入了
import ( m "github.com/beego/admin/src/models" "github.com/astaxie/beego/logs" "encoding/json" )
func (this *UserController) AddUser() { log := logs.NewLogger(10000) log.SetLogger("file", `{"filename":"user.log"}`) u := m.User{} uinfo,_ := json.Marshal(u) if err := this.ParseForm(&u); err != nil { //handle error this.Rsp(false, err.Error()) return } id, err := m.AddUser(&u) if err == nil && id > 0 { log.Info("加入用户",string(uinfo)) this.Rsp(true, "Success") return } else { this.Rsp(false, err.Error()) return } log.Close() }
之后生成的日志格式为 2016/04/23 16:09:59 [I] 加入用户%!(EXTRA string=`{"Id":0,"Username":"","Password":"","Repassword":"","Nickname":"","Email":"","Remark":"","Status":0,"Lastlogintime":"0001-01-01T00:00:00Z","Createtime":"0001-01-01T00:00:00Z","Role":null}) 为何生成的日志 会有 %!(EXTRAstring='的字样 如果把这个多余的部分 去掉 球解
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在user.go里面给增加user写了一个日志
引入了
之后生成的日志格式为
2016/04/23 16:09:59 [I] 加入用户%!(EXTRA string=`{"Id":0,"Username":"","Password":"","Repassword":"","Nickname":"","Email":"","Remark":"","Status":0,"Lastlogintime":"0001-01-01T00:00:00Z","Createtime":"0001-01-01T00:00:00Z","Role":null})
为何生成的日志 会有 %!(EXTRAstring='的字样 如果把这个多余的部分 去掉 球解
The text was updated successfully, but these errors were encountered: