Skip to content

Commit

Permalink
Merge pull request #1369 from wangle201210/develop
Browse files Browse the repository at this point in the history
fix print log on windows
  • Loading branch information
gqcn authored Aug 9, 2021
2 parents fc1dfb7 + 9d4382d commit fb5a1f2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion os/glog/glog_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit fb5a1f2

Please sign in to comment.