Documentation ¶
Overview ¶
Package text provides the implementation of an event handler that outputs events in a human-readable format.
Importing this package has the side effect of configuring the default logger to use a text handler if stdout is a terminal.
Index ¶
Constants ¶
const DefaultTimeFormat = "2006-01-02 15:04:05.000"
DefaultTimeFormat is the default time format set on Handler.
Variables ¶
var DefaultPrefix string
DefaultPrefix is used by the default handler configured when the program's standard output is a terminal.
The value is "program-name[pid]: "
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct { Output io.Writer // writer receiving the formatted events Prefix string // written at the beginning of each formatted event TimeFormat string // format used for the event's time TimeLocation *time.Location // location to output the event time in EnableArgs bool // output detailes of each args in the events // contains filtered or unexported fields }
Handler is an event handler which format events in a human-readable format and writes them to its output.
It is safe to use a handler concurrently from multiple goroutines.
func NewHandler ¶
NewHandler creates a new handler which writes to output with a prefix on each line.
func (*Handler) HandleEvent ¶
func (h *Handler) HandleEvent(e *events.Event)
HandleEvent satisfies the events.Handler interface.