chore: set log structure first

refactor/fs
Noah Hsu 2022-06-14 17:18:58 +08:00
parent e3d2e6dd64
commit e4b956b091
2 changed files with 14 additions and 9 deletions

View File

@ -1,26 +1,30 @@
package bootstrap
import (
"log"
"time"
"github.com/alist-org/alist/v3/cmd/args"
"github.com/alist-org/alist/v3/conf"
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
"github.com/sirupsen/logrus"
"log"
"time"
)
func init() {
logrus.SetFormatter(&logrus.TextFormatter{
ForceColors: true,
EnvironmentOverrideColors: true,
TimestampFormat: "2006-01-02 15:04:05",
FullTimestamp: true,
})
}
func Log() {
log.SetOutput(logrus.StandardLogger().Out)
if args.Debug {
logrus.SetLevel(logrus.DebugLevel)
logrus.SetReportCaller(true)
}
logrus.SetFormatter(&logrus.TextFormatter{
ForceColors: true,
EnvironmentOverrideColors: true,
TimestampFormat: "2006-01-02 15:04:05",
FullTimestamp: true,
})
logConfig := conf.Conf.Log
if logConfig.Enable {
var (

View File

@ -3,13 +3,14 @@ package main
import (
"flag"
"fmt"
"os"
"github.com/alist-org/alist/v3/bootstrap"
"github.com/alist-org/alist/v3/cmd/args"
"github.com/alist-org/alist/v3/conf"
_ "github.com/alist-org/alist/v3/drivers"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
"os"
)
func init() {