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"
"fmt"
)
type fieldKey string
type FieldMap map[fieldKey]string
@ -24,7 +25,17 @@ func (f FieldMap) resolve(key fieldKey) string {
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) {