28 lines
506 B
Go
28 lines
506 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path"
|
|
"runtime"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
var log *logrus.Logger
|
|
|
|
func initLogger() {
|
|
log = logrus.New()
|
|
log.SetOutput(os.Stdout)
|
|
log.SetLevel(logrus.DebugLevel)
|
|
log.SetFormatter(&logrus.TextFormatter{
|
|
FullTimestamp: true,
|
|
TimestampFormat: "2006-01-02 15:04:05",
|
|
CallerPrettyfier: func(f *runtime.Frame) (string, string) {
|
|
filename := path.Base(f.File)
|
|
return "", fmt.Sprintf("%s:%d", filename, f.Line)
|
|
},
|
|
})
|
|
log.SetReportCaller(true)
|
|
}
|