From 9ee76ecc93dfba4650b6b9b5d5b9d1ade8091518 Mon Sep 17 00:00:00 2001 From: wanna Date: Sun, 8 Aug 2021 16:23:25 +0800 Subject: [PATCH 1/2] fix print log on windows --- os/glog/glog_logger.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/os/glog/glog_logger.go b/os/glog/glog_logger.go index 3a87e9aab..7079a75e5 100644 --- a/os/glog/glog_logger.go +++ b/os/glog/glog_logger.go @@ -9,6 +9,7 @@ package glog import ( "context" "fmt" + "github.com/fatih/color" "github.com/gogf/gf/container/gtype" "github.com/gogf/gf/internal/intlog" "github.com/gogf/gf/os/gfpool" @@ -250,7 +251,7 @@ func (l *Logger) printToWriter(ctx context.Context, input *HandlerInput) { // printToStdout outputs logging content to stdout. func (l *Logger) printToStdout(ctx context.Context, input *HandlerInput) { if l.config.StdoutPrint { - if _, err := os.Stdout.Write(input.getBuffer(true).Bytes()); err != nil { + if _, err := fmt.Fprintf(color.Output, input.getBuffer(true).String()) ; err != nil { intlog.Error(ctx, err) } } From 9d4382d12eb8388f1249f4a68ceb05fa1ebb2e65 Mon Sep 17 00:00:00 2001 From: wanna Date: Sun, 8 Aug 2021 16:58:15 +0800 Subject: [PATCH 2/2] fmt --- 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 7079a75e5..f369db3f9 100644 --- a/os/glog/glog_logger.go +++ b/os/glog/glog_logger.go @@ -251,7 +251,7 @@ func (l *Logger) printToWriter(ctx context.Context, input *HandlerInput) { // printToStdout outputs logging content to stdout. func (l *Logger) printToStdout(ctx context.Context, input *HandlerInput) { if l.config.StdoutPrint { - if _, err := fmt.Fprintf(color.Output, input.getBuffer(true).String()) ; err != nil { + if _, err := fmt.Fprintf(color.Output, input.getBuffer(true).String()); err != nil { intlog.Error(ctx, err) } }