Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FormatterConfig ¶ added in v0.3.0
type FormatterConfig struct {
FormatterType FormatterType
ExternalFormatter IFormatter
TimestampFormat string
PatternStyle string // [text formatter] style template for formatting the data, which determines the order of the fields and the presentation style.
EnableQuote bool // [text formatter] keep the string literal, while escaping safely if necessary.
EnableQuoteEmptyFields bool // [text formatter] when the value of field is empty, keep the string literal.
DisableColors bool // [text formatter] adding color rendering to the output.
DisableTimestamp bool // [json formatter] allows disabling automatic timestamps in output.
DisableHTMLEscape bool // [json formatter] allows disabling html escaping in output.
PrettyPrint bool // [json|xml formatter] will indent all json logs.
}
type FormatterType ¶ added in v0.3.0
type FormatterType int
const ( FormatterTypeText FormatterType = 1 FormatterTypeJSON FormatterType = 2 FormatterTypeXML FormatterType = 3 )
type IFormatter ¶
func GetNewFormatter ¶
func GetNewFormatter(formatterCfg FormatterConfig) IFormatter
type JSONFormatter ¶
type JSONFormatter struct {
// contains filtered or unexported fields
}
func NewJSONFormatter ¶
func NewJSONFormatter(formatterCfg FormatterConfig) *JSONFormatter
type TextFormatter ¶
type TextFormatter struct {
EnableQuote bool
EnableQuoteEmptyFields bool
DisableColors bool
TimestampFormat string
// contains filtered or unexported fields
}
TextFormatter formats logs into text
func NewTextFormatter ¶
func NewTextFormatter(formatterCfg FormatterConfig) *TextFormatter
func (*TextFormatter) ColorRender ¶
func (f *TextFormatter) ColorRender(b *bytes.Buffer, entry *message.Entry)
func (*TextFormatter) ColorRenderV2 ¶
func (f *TextFormatter) ColorRenderV2(b *bytes.Buffer, entry *message.Entry)
type XMLFormatter ¶
func NewXMLFormatter ¶
func NewXMLFormatter(formatterCfg FormatterConfig) *XMLFormatter
Click to show internal directories.
Click to hide internal directories.