Skip to content

Commit

Permalink
fix: ANSI color codes being printed on Windows (#1225)
Browse files Browse the repository at this point in the history
* added go-colorable

* fixed bug which prevented windows builds
  • Loading branch information
kwitsch committed Nov 7, 2023
1 parent 23ce44d commit d87e6b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -15,7 +15,7 @@ require (
github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/golang-lru v1.0.2
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-colorable v0.1.13
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/miekg/dns v1.1.56
github.com/mroth/weightedrand/v2 v2.1.0
Expand Down
4 changes: 4 additions & 0 deletions log/logger.go
Expand Up @@ -8,6 +8,7 @@ import (
"strings"
"sync"

"github.com/mattn/go-colorable"
"github.com/sirupsen/logrus"
prefixed "github.com/x-cray/logrus-prefixed-formatter"
"golang.org/x/exp/maps"
Expand Down Expand Up @@ -111,6 +112,9 @@ func ConfigureLogger(cfg *Config) {

logger.SetFormatter(logFormatter)

// Windows does not support ANSI colors
logger.SetOutput(colorable.NewColorableStdout())

case FormatTypeJson:
logger.SetFormatter(&logrus.JSONFormatter{})
}
Expand Down
4 changes: 3 additions & 1 deletion server/server_config_trigger_windows.go
@@ -1,4 +1,6 @@
package server

func registerPrintConfigurationTrigger(s *Server) {
import "context"

func registerPrintConfigurationTrigger(ctx context.Context, s *Server) {
}

0 comments on commit d87e6b4

Please sign in to comment.