Added comment documentation for FieldMap

This commit is contained in:
Ryan Canty 2016-11-18 11:02:11 -08:00
parent d5ca23f998
commit fcf4b8f229
No known key found for this signature in database
GPG Key ID: 2F7E8BA951840061
1 changed files with 12 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
) )
type fieldKey string type fieldKey string
type FieldMap map[fieldKey]string type FieldMap map[fieldKey]string
@ -24,6 +25,16 @@ func (f FieldMap) resolve(key fieldKey) string {
type JSONFormatter struct { type JSONFormatter struct {
// TimestampFormat sets the format used for marshaling timestamps. // TimestampFormat sets the format used for marshaling timestamps.
TimestampFormat string TimestampFormat string
// FieldMap allows users to customize the names of keys for various fields.
// As an example:
// formatter := &JSONFormatter{
// FieldMap: FieldMap{
// FieldKeyTime: "@timestamp",
// FieldKeyLevel: "@level",
// FieldKeyLevel: "@message",
// },
// }
FieldMap FieldMap FieldMap FieldMap
} }