Added comment documentation for FieldMap
diff --git a/json_formatter.go b/json_formatter.go index 1e3e2bc..f3729bf 100644 --- a/json_formatter.go +++ b/json_formatter.go
@@ -4,6 +4,7 @@ "encoding/json" "fmt" ) + type fieldKey string type FieldMap map[fieldKey]string @@ -24,7 +25,17 @@ type JSONFormatter struct { // TimestampFormat sets the format used for marshaling timestamps. TimestampFormat string - FieldMap FieldMap + + // 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 } func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {