feat: build wahrwelt A/D toolkit
This commit is contained in:
1 parent
303438d206
commit
653924d8c6
564 files changed
+36310
-49998
No files matched your search
@@ -0,0 +1,35 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sync"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var once = sync.Once{}
|
||||
|
||||
func Init() {
|
||||
once.Do(func() {
|
||||
logrus.SetFormatter(&CustomFormatter{
|
||||
FullTimestamp: true,
|
||||
TimestampFormat: "2006-01-02T15:04:05.000Z07:00",
|
||||
DisableLevelTruncation: false,
|
||||
CallerPrettyfier: func(f *runtime.Frame) (string, string) {
|
||||
filename := filepath.Base(f.File)
|
||||
return "", fmt.Sprintf("%s:%d", filename, f.Line)
|
||||
},
|
||||
})
|
||||
logrus.SetReportCaller(true)
|
||||
})
|
||||
if ll := os.Getenv("NEO_LOG_LEVEL"); ll != "" {
|
||||
level, err := logrus.ParseLevel(ll)
|
||||
if err != nil {
|
||||
logrus.Fatalf("Не удалось разобрать уровень журналирования %v: %v", ll, err)
|
||||
}
|
||||
logrus.SetLevel(level)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user