将日志目录移动到config子目录,方便docker映射
This commit is contained in:
parent
fb4c46279c
commit
d41bba79b6
2
main.go
2
main.go
|
@ -40,7 +40,7 @@ func init() {
|
|||
TimestampFormat: "2006-01-02 15:04:05",
|
||||
LogFormat: "[%time%] [%lvl%]: %msg% \n",
|
||||
}
|
||||
w, err := rotates.New(path.Join("logs", "%Y-%m-%d.log"), rotates.WithRotationTime(time.Hour*24))
|
||||
w, err := rotates.New(path.Join("config", "logs", "%Y-%m-%d.log"), rotates.WithRotationTime(time.Hour*24))
|
||||
if err != nil {
|
||||
log.Errorf("rotates init err: %v", err)
|
||||
panic(err)
|
||||
|
|
|
@ -271,7 +271,7 @@ func stopStudy() gin.HandlerFunc {
|
|||
|
||||
func getLog() gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
ctx.File(fmt.Sprintf("./logs/%v.log", time.Now().Format("2006-01-02")))
|
||||
ctx.File(fmt.Sprintf("./config/logs/%v.log", time.Now().Format("2006-01-02")))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue