feat: log to file

This commit is contained in:
Simon Ding
2024-07-25 20:28:13 +08:00
parent 04df9adfdf
commit 891be34504
6 changed files with 63 additions and 11 deletions

View File

@@ -143,3 +143,16 @@ func (s *Server) DeleteDownloadCLient(c *gin.Context) (interface{}, error) {
s.db.DeleteDownloadCLient(id)
return "success", nil
}
type logLovelIn struct {
Level string `json:"level"`
}
func (s *Server) SetLogLevel(c *gin.Context) (interface{}, error) {
var in logLovelIn
if err := c.ShouldBindJSON(&in); err != nil {
return nil, errors.Wrap(err, "bind json")
}
log.SetLogLevel(in.Level)
return "success", nil
}