From 27be9d07993049995fcfd9f7b12a92c4352d25c3 Mon Sep 17 00:00:00 2001 From: Valere JEANTET Date: Thu, 11 Jan 2018 21:55:34 +0100 Subject: [PATCH] codecs : line encoder - fix crash when given format option is "" --- codecs/line/encoder.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codecs/line/encoder.go b/codecs/line/encoder.go index 33185bee..ff9cca7a 100644 --- a/codecs/line/encoder.go +++ b/codecs/line/encoder.go @@ -45,6 +45,8 @@ func NewEncoder(w io.Writer) *encoder { Format: `{{ TS "dd/MM/yyyy:HH:mm:ss" . }} {{.host}} {{.message}}`, }, } + loc, _ := commons.NewLocation(e.options.Format, "") + e.formatTpl, _, _ = loc.TemplateWithOptions(e.options.Var) return e }