Documentation ¶
Index ¶
Constants ¶
View Source
const ( // FieldKeyMsg is the key for message FieldKeyMsg = "message" // FieldKeyLevel is the key for level FieldKeyLevel = "level" // FieldKeyTime is the key for time FieldKeyTime = "time" // FieldKeyData is the key for data FieldKeyData = "data" // DefaultTimestampFormat is the default formtat for presenting time DefaultTimestampFormat = time.RFC3339 )
Variables ¶
This section is empty.
Functions ¶
func LoggingHandler ¶
LoggingHandler return a http.Handler that wraps h and logs requests to out in ECS Format
Types ¶
type ECSFormatter ¶
type ECSFormatter struct { // TimestampFormat sets the format used for marshaling timestamps. TimestampFormat string // DisableTimestamp allows disabling automatic timestamps in output DisableTimestamp bool // FieldMap allows users to customize the names of keys for various fields. // As an example: // formatter := &JSONFormatter{ // FieldMap: FieldMap{ // FieldKeyTime: "@timestamp", // FieldKeyLevel: "@level", // FieldKeyMsg: "@message", // }, // } FieldMap FieldMap }
ECSFormatter formats logs in ecs-logger compatible format with fields inside data
func NewFormatter ¶
func NewFormatter() *ECSFormatter
NewFormatter creates a new instance of ECS Formatter.
Click to show internal directories.
Click to hide internal directories.