Windows escape sequence fix

Our logger wasn't entirely compatible with Windows escape sequences when not in TTY mode. This fix changes the stderr to one that automatically transforms the escape sequences to some Windows compatible ones.

Signed-off-by: guillaume <guillaume.derouville@gmail.com>
This commit is contained in:
guillaume
2022-03-02 12:13:26 +01:00
parent 17c45ea36c
commit 52655916c6
3 changed files with 5 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import (
"fmt"
"os"
"github.com/mattn/go-colorable"
"github.com/rs/zerolog"
"github.com/spf13/viper"
"golang.org/x/term"
@@ -22,7 +23,7 @@ func New() zerolog.Logger {
Logger()
if !jsonLogs() {
logger = logger.Output(&PlainOutput{Out: os.Stderr})
logger = logger.Output(&PlainOutput{Out: colorable.NewColorableStderr()})
} else {
logger = logger.With().Timestamp().Caller().Logger()
}