Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultTemplate = `` /* 165-byte string literal not displayed */
DefaultTemplate is used when no template is given.
Variables ¶
View Source
var NewLine = []byte("\n")
NewLine contains ['\n']
Functions ¶
func RegisterStacktracer ¶
func RegisterStacktracer(tracer StacktraceFormatter)
RegisterStacktracer adds a StacktraceFormatter to a thé list.
Types ¶
type Entry ¶
type Entry struct { Timestamp *time.Time `djson:"timestamp,@timestamp,time,date,ts"` RawTimestamp string `djson:"timestamp,@timestamp,time,date,ts"` FloatTimestamp float64 `djson:"timestamp,@timestamp,time,date,ts"` Severity string `djson:"severity,level,log.level"` Message string `djson:"message,msg,text,*.message"` Name string `djson:"app,name,service.name"` // IncludeFields is used by processors to indicate which fields should be included IncludeFields []string // ExcludeFields is used by processors to indicate which fields should be skipped ExcludeFields []string }
Entry represents a structured logline to be formatted.
type Formatter ¶
type Formatter struct { Colorize bool ShowFields bool MaxFieldLength int ShowPrefix bool ShowSuffix bool IncludeFields []string ExcludeFields []string // contains filtered or unexported fields }
Formatter is the system that outputs a sturctured log entry as a nice readable line using a small go template (which could be given via the cli)
func NewFormatter ¶
NewFormatter compiles the given fmt as a go template and returns a Formatter
type StacktraceFormatter ¶
type StacktraceFormatter interface { Detect(json map[string]interface{}) bool Format(json map[string]interface{}) string }
StacktraceFormatter interfaces with the Formatter to format a possible stacktrace in a JSON log line. The Detect method returns true if it's compatible.
Click to show internal directories.
Click to hide internal directories.