Documentation ¶
Index ¶
Constants ¶
View Source
const JSONFormatter jsonFormatter = "JSONFormatter"
Formatter that returns log message in form of JSON.
Variables ¶
This section is empty.
Functions ¶
func LenPrintableText ¶
Returns utf8.RuneCountInString of text without ANSI color codes.
func PaintBuffer ¶
Returns []byte prepended by ANSI color code and appended by ANSI color reset code.
Types ¶
type Color ¶
type Color string
const ( ANSIReset Color = "\033[0m" ANSIColorRed Color = "\033[31m" ANSIColorGreen Color = "\033[32m" ANSIColorYellow Color = "\033[33m" ANSIColorBlue Color = "\033[34m" ANSIColorPurple Color = "\033[35m" ANSIColorCyan Color = "\033[36m" ANSIColorWhite Color = "\033[37m" ANSIColorGray Color = "\033[90m" ANSIFontBold Color = "\033[1m" ColorTrace Color = ANSIColorGray ColorDebug Color = ANSIColorCyan ColorInfo Color = ANSIColorGreen ColorWarn Color = ANSIColorYellow ColorError Color = ANSIColorRed ColorFatal Color = ANSIFontBold + ANSIColorRed )
type Log ¶
type Log struct { LevelCode int `json:"levelCode"` Level string `json:"level"` Location string `json:"location"` Message string `json:"message"` Tags map[string][]string `json:"tags"` DateUnix time.Time `json:"date"` }
Log model returned by JSONFormatter.
type LogFormatter ¶
type LogFormatter interface { // Returns formatted log message in []byte. GetOutput(level int, message string, tags map[string][]string, calldepth int) []byte }
Carries log message formatting and marshalling logic.
func Default ¶
func Default() LogFormatter
Returns default instance of Formatter with time.RFC822 as timeFormat. Formatter that returns log message in form of colorized plain text rows of fixed length.
func New ¶
func New(timeFormat string) LogFormatter
Returns default instance of Formatter with timeFormat. Formatter that returns log message in form of colorized plain text rows of fixed length.
Click to show internal directories.
Click to hide internal directories.