From 03377c6168987e4341f3ce44b640f31a0cd19af8 Mon Sep 17 00:00:00 2001 From: Derek Che Date: Sat, 3 Jan 2015 23:56:39 -0800 Subject: [PATCH] rename f.appendKeyValue to printKeyValue printKeyValue is working similar like printColored, not using any fields of TextFormatter, should be a util func instead of a method of TextFormatter. Signed-off-by: Derek Che --- text_formatter.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/text_formatter.go b/text_formatter.go index 78e7889..bbf6110 100644 --- a/text_formatter.go +++ b/text_formatter.go @@ -59,12 +59,12 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { printColored(b, entry, keys) } else { if !f.DisableTimestamp { - f.appendKeyValue(b, "time", entry.Time.Format(time.RFC3339)) + printKeyValue(b, "time", entry.Time.Format(time.RFC3339)) } - f.appendKeyValue(b, "level", entry.Level.String()) - f.appendKeyValue(b, "msg", entry.Message) + printKeyValue(b, "level", entry.Level.String()) + printKeyValue(b, "msg", entry.Message) for _, key := range keys { - f.appendKeyValue(b, key, entry.Data[key]) + printKeyValue(b, key, entry.Data[key]) } } @@ -104,7 +104,7 @@ func needsQuoting(text string) bool { return true } -func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key, value interface{}) { +func printKeyValue(b *bytes.Buffer, key, value interface{}) { switch value.(type) { case string: if needsQuoting(value.(string)) {