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 <drc@yahoo-inc.com>
This commit is contained in:
Derek Che 2015-01-03 23:56:39 -08:00
parent d2f9ffa1d9
commit 03377c6168
1 changed files with 5 additions and 5 deletions

View File

@ -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)) {