diff --git a/cmd/logger/console.go b/cmd/logger/console.go index f9d5f9fb3..5ea222540 100644 --- a/cmd/logger/console.go +++ b/cmd/logger/console.go @@ -119,16 +119,16 @@ func (f fatalMsg) pretty(msg string, args ...interface{}) { ansiSaveAttributes() // Print banner with or without the log tag if !tagPrinted { - fmt.Print(logBanner) + c.Print(logBanner) tagPrinted = true } else { - fmt.Print(emptyBanner) + c.Print(emptyBanner) } // Restore the text color of the error message ansiRestoreAttributes() ansiMoveRight(bannerWidth) // Continue error message printing - fmt.Println(line) + c.Println(line) break } } diff --git a/cmd/logger/target/console/console.go b/cmd/logger/target/console/console.go index 48634e902..74e0c7b2b 100644 --- a/cmd/logger/target/console/console.go +++ b/cmd/logger/target/console/console.go @@ -25,6 +25,7 @@ import ( "github.com/minio/minio/cmd/logger" "github.com/minio/minio/cmd/logger/message/log" "github.com/minio/minio/pkg/color" + "github.com/minio/minio/pkg/console" ) // Target implements loggerTarget to send log @@ -109,7 +110,7 @@ func (c *Target) Send(e interface{}, logKind string) error { apiString, timeString, deploymentID, requestID, remoteHost, host, userAgent, msg, tagString, strings.Join(trace, "\n")) - fmt.Println(output) + console.Println(output) return nil } diff --git a/cmd/logger/utils.go b/cmd/logger/utils.go index 22649c2c1..18fe889e5 100644 --- a/cmd/logger/utils.go +++ b/cmd/logger/utils.go @@ -19,6 +19,7 @@ package logger import ( "fmt" "regexp" + "runtime" "github.com/minio/minio/pkg/color" ) @@ -32,18 +33,27 @@ func ansiEscape(format string, args ...interface{}) { } func ansiMoveRight(n int) { + if runtime.GOOS == "windows" { + return + } if color.IsTerminal() { ansiEscape("[%dC", n) } } func ansiSaveAttributes() { + if runtime.GOOS == "windows" { + return + } if color.IsTerminal() { ansiEscape("7") } } func ansiRestoreAttributes() { + if runtime.GOOS == "windows" { + return + } if color.IsTerminal() { ansiEscape("8") }