Files
OpenList/bootstrap/log.go

23 lines
449 B
Go
Raw Normal View History

2020-12-24 01:39:45 +08:00
package bootstrap
import (
"github.com/Xhofe/alist/conf"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
)
2021-02-04 10:02:34 +08:00
// init logrus
2020-12-24 01:39:45 +08:00
func InitLog() {
if conf.Debug {
log.SetLevel(log.DebugLevel)
2021-03-05 21:25:44 +08:00
} else {
2020-12-24 01:39:45 +08:00
gin.SetMode(gin.ReleaseMode)
}
log.SetFormatter(&log.TextFormatter{
2021-03-05 21:25:44 +08:00
ForceColors: true,
EnvironmentOverrideColors: true,
TimestampFormat: "2006-01-02 15:04:05",
FullTimestamp: true,
2020-12-24 01:39:45 +08:00
})
2021-03-05 21:25:44 +08:00
}