Skip to content

Commit

Permalink
dont use log colours in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
BeryJu committed Nov 25, 2024
1 parent 89a6362 commit d183ad7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pkg/extconfig/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ func (e *ExtConfig) BuildLoggerWithLevel(l zapcore.Level) *zap.Logger {
config.Development = false
config.Encoding = "console"
config.EncoderConfig = zap.NewDevelopmentEncoderConfig()
config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
if !CI() {
config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
}
}
config.EncoderConfig.EncodeDuration = zapcore.MillisDurationEncoder
log, err := config.Build()
Expand Down
6 changes: 5 additions & 1 deletion pkg/extconfig/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ var (
BuildHash = ""
)

func CI() bool {
return strings.EqualFold(os.Getenv("CI"), "true")
}

func FullVersion() string {
if os.Getenv("CI") == "true" {
if CI() {
Version = "99.99.99"
BuildHash = "test"
}
Expand Down

0 comments on commit d183ad7

Please sign in to comment.