From 2771310fe23acb298ae7c530853a2fb15d1fcd43 Mon Sep 17 00:00:00 2001 From: charlie <3140647@qq.com> Date: Wed, 20 Apr 2022 17:33:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=AF=AB=E7=A7=92=E5=AF=B9?= =?UTF-8?q?=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logx/log.go | 8 +++++++- logx/logrus.go | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/logx/log.go b/logx/log.go index 7a2e117..6d10af0 100644 --- a/logx/log.go +++ b/logx/log.go @@ -1,5 +1,11 @@ package logx +var std = NewLogrus() + +func StandardLogger() Logger { + return std +} + // Fields type, used to pass to `WithFields`. type Fields map[string]any @@ -13,7 +19,7 @@ type Logger interface { Debugf(format string, args ...any) Info(args ...any) Infof(format string, args ...any) - Warn(args ...any) + Warn(args ...any) Warnf(format string, args ...any) Error(args ...any) Errorf(format string, args ...any) diff --git a/logx/logrus.go b/logx/logrus.go index 09edbcd..81f1396 100644 --- a/logx/logrus.go +++ b/logx/logrus.go @@ -18,7 +18,7 @@ func NewLogrus() Logger { logger.SetFormatter( &nested.Formatter{ - TimestampFormat: "2006-01-02 15:04:05.999", + TimestampFormat: "2006-01-02 15:04:05.000", NoColors: false, CustomCallerFormatter: nestedCallerFormatter, }) @@ -88,7 +88,7 @@ func (l *logrusWrpper) Errorf(format string, args ...any) { } func (l *logrusWrpper) Fatal(args ...any) { - l.logrus.Fatal(args) + l.logrus.Fatal(args...) } func (l *logrusWrpper) Fatalf(format string, args ...any) {