Documentation
¶
Overview ¶
Package logformat provides some ad-hoc log formatting for some of my projects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultFormatters = Formatters{ "debug": colors.Gray, "info": colors.Purple, "warn": colors.Yellow, "warning": colors.Yellow, "error": colors.Red, "fatal": colors.Red, "critical": colors.Red, "emergency": colors.Red, "string": colors.None, "number": colors.None, "bool": colors.None, "date": colors.Gray, "object.key": colors.Purple, "object.separator": colors.Gray, "object.value": colors.None, "array.delimiter": colors.Gray, "array.separator": colors.Gray, "message": colors.None, "program": colors.Gray, "stage": colors.Gray, "version": colors.Gray, }
DefaultFormatters is a set of default formatters.
View Source
var NoColor = Formatters{ "debug": colors.None, "info": colors.None, "warn": colors.None, "warning": colors.None, "error": colors.None, "fatal": colors.None, "critical": colors.None, "emergency": colors.None, "string": colors.None, "number": colors.None, "bool": colors.None, "date": colors.None, "object.key": colors.None, "object.separator": colors.None, "object.value": colors.None, "array.delimiter": colors.None, "array.separator": colors.None, "message": colors.None, "program": colors.None, "stage": colors.None, "version": colors.None, }
NoColor is a set of formatters resulting in no colors.
Functions ¶
Types ¶
type DateFormatFunc ¶
DateFormatFunc is the function used for formatting dates.
type FormatFunc ¶
FormatFunc is a function used for formatting values.
type Formatters ¶
type Formatters map[string]FormatFunc
Formatters is a map of formatting functions.
type Option ¶
type Option func(*config)
Option function.
func WithDateFormatter ¶
func WithDateFormatter(v DateFormatFunc) Option
WithDateFormatter overrides the default date formatter.
func WithFormatters ¶
func WithFormatters(v Formatters) Option
WithFormatters overrides the default formatters.
Click to show internal directories.
Click to hide internal directories.