From e0c4f7ccbff32605762614703f6ed94863ef55a3 Mon Sep 17 00:00:00 2001 From: "lindan.he" Date: Sat, 9 Oct 2021 18:32:59 +0800 Subject: [PATCH 1/2] Fixed: #1421 --- os/glog/glog_logger.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/os/glog/glog_logger.go b/os/glog/glog_logger.go index b52b860b1..26ceec229 100644 --- a/os/glog/glog_logger.go +++ b/os/glog/glog_logger.go @@ -10,25 +10,24 @@ import ( "bytes" "context" "fmt" - "github.com/fatih/color" - "github.com/gogf/gf/container/gtype" - "github.com/gogf/gf/internal/intlog" - "github.com/gogf/gf/os/gctx" - "github.com/gogf/gf/os/gfpool" - "github.com/gogf/gf/os/gmlock" - "github.com/gogf/gf/os/gtimer" - "go.opentelemetry.io/otel/trace" "io" "os" "strings" "time" + "github.com/fatih/color" + "github.com/gogf/gf/container/gtype" "github.com/gogf/gf/debug/gdebug" - + "github.com/gogf/gf/internal/intlog" + "github.com/gogf/gf/os/gctx" "github.com/gogf/gf/os/gfile" + "github.com/gogf/gf/os/gfpool" + "github.com/gogf/gf/os/gmlock" "github.com/gogf/gf/os/gtime" + "github.com/gogf/gf/os/gtimer" "github.com/gogf/gf/text/gregex" "github.com/gogf/gf/util/gconv" + "go.opentelemetry.io/otel/trace" ) // Logger is the struct for logging management. @@ -204,7 +203,7 @@ func (l *Logger) print(ctx context.Context, level int, values ...interface{}) { if len(input.Content) > 0 { if input.Content[len(input.Content)-1] == '\n' { // Remove one blank line(\n\n). - if tempStr[0] == '\n' { + if len(tempStr) > 0 && tempStr[0] == '\n' { input.Content += tempStr[1:] } else { input.Content += tempStr From 5ffd362b6e8d1cc4522bdb05b5e2186d56d09190 Mon Sep 17 00:00:00 2001 From: danvinhe Date: Wed, 3 Nov 2021 15:02:21 +0800 Subject: [PATCH 2/2] Update glog_logger.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 多了个空格 --- os/glog/glog_logger.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os/glog/glog_logger.go b/os/glog/glog_logger.go index 43edc0206..bdd873976 100644 --- a/os/glog/glog_logger.go +++ b/os/glog/glog_logger.go @@ -22,7 +22,7 @@ import ( "os" "strings" "time" - + "github.com/gogf/gf/v2/debug/gdebug" "github.com/gogf/gf/v2/os/gfile"