Skip to content

Commit

Permalink
fix: Set default colorizer in wlog-tmpl (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmoylan authored Jul 19, 2021
1 parent 8256783 commit 30bce8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-154.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: fix
fix:
description: Set default colorizer in wlog-tmpl
links:
- https://github.com/palantir/witchcraft-go-logging/pull/154
4 changes: 3 additions & 1 deletion wlog-tmpl/logentryformatter/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"github.com/fatih/color"
)

var defaultColorizer = color.New()

type LogType string

type LogEntry struct {
Expand Down Expand Up @@ -123,7 +125,7 @@ func (f *entryFormatter) Format(lineJSON []byte) (string, error) {
return c.Sprint(logText), nil
}
}
return logText, nil
return defaultColorizer.Sprint(logText), nil
}

func (f *entryFormatter) TemplateObjectDescription() string {
Expand Down

0 comments on commit 30bce8c

Please sign in to comment.