Documentation ¶
Overview ¶
Package format implements a custom format logs
Index ¶
- Constants
- func NewBareFormatPlaceholders() Placeholders
- func NewJSONFormatPlaceholders() Placeholders
- func NewKeyValueFormatPlaceholders() Placeholders
- func NewPrettyFormatPlaceholders() Placeholders
- func ParseFormat(str string) (Placeholders, error)
- type Formatter
- func (formatter *Formatter) DisableRelativePaths()
- func (formatter *Formatter) DisabledColors() bool
- func (formatter *Formatter) DisabledOutput() bool
- func (formatter *Formatter) Format(entry *log.Entry) ([]byte, error)
- func (formatter *Formatter) SetBaseDir(baseDir string) error
- func (formatter *Formatter) SetCustomFormat(str string) error
- func (formatter *Formatter) SetDisabledColors(val bool)
- func (formatter *Formatter) SetDisabledOutput(val bool)
- func (formatter *Formatter) SetFormat(str string) error
Constants ¶
View Source
const ( BareFormatName = "bare" PrettyFormatName = "pretty" JSONFormatName = "json" KeyValueFormatName = "key-value" )
Variables ¶
This section is empty.
Functions ¶
func NewBareFormatPlaceholders ¶
func NewBareFormatPlaceholders() Placeholders
func NewJSONFormatPlaceholders ¶
func NewJSONFormatPlaceholders() Placeholders
func NewKeyValueFormatPlaceholders ¶
func NewKeyValueFormatPlaceholders() Placeholders
func NewPrettyFormatPlaceholders ¶
func NewPrettyFormatPlaceholders() Placeholders
func ParseFormat ¶ added in v0.68.15
Types ¶
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
func NewFormatter ¶
func NewFormatter(phs placeholders.Placeholders) *Formatter
NewFormatter returns a new Formatter instance with default values.
func (*Formatter) DisableRelativePaths ¶ added in v0.68.15
func (formatter *Formatter) DisableRelativePaths()
DisableRelativePaths disables the conversion of absolute paths to relative ones.
func (*Formatter) DisabledColors ¶
DisabledColors returns true if log colors are disabled.
func (*Formatter) DisabledOutput ¶
DisabledOutput returns true if log output is disabled.
func (*Formatter) SetBaseDir ¶ added in v0.68.15
SetBaseDir creates a set of relative paths that are used to convert full paths to relative ones.
func (*Formatter) SetCustomFormat ¶
SetCustomFormat parses and sets custom log format.
func (*Formatter) SetDisabledColors ¶
SetDisabledColors enables/disables log colors.
func (*Formatter) SetDisabledOutput ¶
SetDisabledOutput enables/disables log output.
Directories ¶
Path | Synopsis |
---|---|
Package options represents a set of placeholders options.
|
Package options represents a set of placeholders options. |
Package placeholders represents a set of placeholders for formatting various log values.
|
Package placeholders represents a set of placeholders for formatting various log values. |
Click to show internal directories.
Click to hide internal directories.