From 30bce8c0d22193771bb35187542bcbf29933b531 Mon Sep 17 00:00:00 2001 From: Brad Moylan Date: Mon, 19 Jul 2021 11:07:54 -0700 Subject: [PATCH] fix: Set default colorizer in wlog-tmpl (#154) --- changelog/@unreleased/pr-154.v2.yml | 5 +++++ wlog-tmpl/logentryformatter/formatter.go | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 changelog/@unreleased/pr-154.v2.yml diff --git a/changelog/@unreleased/pr-154.v2.yml b/changelog/@unreleased/pr-154.v2.yml new file mode 100644 index 00000000..4e95e30b --- /dev/null +++ b/changelog/@unreleased/pr-154.v2.yml @@ -0,0 +1,5 @@ +type: fix +fix: + description: Set default colorizer in wlog-tmpl + links: + - https://github.com/palantir/witchcraft-go-logging/pull/154 diff --git a/wlog-tmpl/logentryformatter/formatter.go b/wlog-tmpl/logentryformatter/formatter.go index c44e7bd8..b1b0eaf8 100644 --- a/wlog-tmpl/logentryformatter/formatter.go +++ b/wlog-tmpl/logentryformatter/formatter.go @@ -23,6 +23,8 @@ import ( "github.com/fatih/color" ) +var defaultColorizer = color.New() + type LogType string type LogEntry struct { @@ -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 {