console logger: enable colors on Windows too ...

... now that zerolog supports this feature
This commit is contained in:
Nicola Murino 2021-12-20 18:47:18 +01:00
parent 00a02dc14d
commit 8174349032
No known key found for this signature in database
GPG key ID: 2F1FB59433D5A8CB
3 changed files with 3 additions and 5 deletions

2
go.mod
View file

@ -38,7 +38,7 @@ require (
github.com/prometheus/client_golang v1.11.0 github.com/prometheus/client_golang v1.11.0
github.com/rs/cors v1.8.0 github.com/rs/cors v1.8.0
github.com/rs/xid v1.3.0 github.com/rs/xid v1.3.0
github.com/rs/zerolog v1.26.2-0.20211217020337-0c8d3c0b10c3 github.com/rs/zerolog v1.26.2-0.20211219225053-665519c4da50
github.com/shirou/gopsutil/v3 v3.21.11 github.com/shirou/gopsutil/v3 v3.21.11
github.com/spf13/afero v1.6.0 github.com/spf13/afero v1.6.0
github.com/spf13/cobra v1.3.0 github.com/spf13/cobra v1.3.0

4
go.sum
View file

@ -726,8 +726,8 @@ github.com/rs/xid v1.3.0 h1:6NjYksEUlhurdVehpc7S7dk6DAmcKv8V9gG0FsVN2U4=
github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
github.com/rs/zerolog v1.26.2-0.20211217020337-0c8d3c0b10c3 h1:TwTFgwG2b3h0GNPv3o9+Thu9n0lrIj2t+IsWHY/DbOE= github.com/rs/zerolog v1.26.2-0.20211219225053-665519c4da50 h1:VJhaAvuqYuF+iHhd3R39cAkoYvu2MgHnKSAgfzo1gMw=
github.com/rs/zerolog v1.26.2-0.20211217020337-0c8d3c0b10c3/go.mod h1:eHQZiDw9MQWpDKmOvvJAV5O5us43b8IMRafp/wTdspo= github.com/rs/zerolog v1.26.2-0.20211219225053-665519c4da50/go.mod h1:ECycPdEIogh4sTZcfHEJw+SJmB1Q8XBIsXXCAX11zCI=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=

View file

@ -13,7 +13,6 @@ import (
"fmt" "fmt"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"time" "time"
ftpserverlog "github.com/fclairamb/go-log" ftpserverlog "github.com/fclairamb/go-log"
@ -199,7 +198,6 @@ func EnableConsoleLogger(level zerolog.Level) {
consoleOutput := zerolog.ConsoleWriter{ consoleOutput := zerolog.ConsoleWriter{
Out: os.Stdout, Out: os.Stdout,
TimeFormat: dateFormat, TimeFormat: dateFormat,
NoColor: runtime.GOOS == "windows",
} }
consoleLogger = zerolog.New(consoleOutput).With().Timestamp().Logger().Level(level) consoleLogger = zerolog.New(consoleOutput).With().Timestamp().Logger().Level(level)
} }