fix(be):使用next-terminal 自定义的日志
This commit is contained in:
22
main.go
22
main.go
@ -1,19 +1,14 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"next-terminal/server/api"
|
||||
"next-terminal/server/config"
|
||||
"next-terminal/server/global"
|
||||
|
||||
nested "github.com/antonfisher/nested-logrus-formatter"
|
||||
"github.com/labstack/gommon/log"
|
||||
"github.com/robfig/cron/v3"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const Version = "v0.3.4"
|
||||
@ -35,23 +30,6 @@ func Run() error {
|
||||
\____|__ /\___ >__/\_ \ |__| |____| \___ >__| |__|_| /__|___| (____ /____/
|
||||
\/ \/ \/ \/ \/ \/ \/ ` + Version + "\n\n")
|
||||
|
||||
var err error
|
||||
//logrus.SetReportCaller(true)
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
logrus.SetFormatter(&nested.Formatter{
|
||||
HideKeys: true,
|
||||
FieldsOrder: []string{"component", "category"},
|
||||
})
|
||||
|
||||
writer1 := &bytes.Buffer{}
|
||||
writer2 := os.Stdout
|
||||
writer3, err := os.OpenFile("log/next-terminal.log", os.O_WRONLY|os.O_CREATE, 0755)
|
||||
if err != nil {
|
||||
log.Fatalf("create file log.txt failed: %v", err)
|
||||
}
|
||||
|
||||
logrus.SetOutput(io.MultiWriter(writer1, writer2, writer3))
|
||||
|
||||
global.Config = config.SetupConfig()
|
||||
|
||||
global.Store = global.NewStore()
|
||||
|
Reference in New Issue
Block a user