Documentation
¶
Overview ¶
Package native/level provides additions of slf4g/level for the native implementations.
Index ¶
- Variables
- func NewNames() level.Names
- type Colorizer
- type ColorizerMap
- type Named
- type Namesdeprecated
- type NamesAwaredeprecated
Constants ¶
This section is empty.
Variables ¶
var DefaultNames = NewNames()
DefaultNames is the default instance of Names which should cover the most of the cases.
var ErrIllegalLevel = level.ErrIllegalLevel
ErrIllegalLevel represents that an illegal level.Level value/name was provided.
Deprecated: use level.ErrIllegalLevel instead.
Functions ¶
Types ¶
type Colorizer ¶ added in v0.9.0
type Colorizer interface { // ColorizeByLevel is colorizing the given input for the given level.Level. ColorizeByLevel(lvl level.Level, input string) string }
Colorizer is colorizing inputs for given levels by ANSI escape codes. See: https://en.wikipedia.org/wiki/ANSI_escape_code
var DefaultColorizer Colorizer = ColorizerMap{ level.Trace: `�[30;1m`, level.Debug: `�[36;1m`, level.Info: `�[34;1m`, level.Warn: `�[33;1m`, level.Error: `�[31;1m`, level.Fatal: `�[35;1m`, }
DefaultColorizer is the default instance of Colorizer which should cover the most of the cases.
func NewColorizerFacade ¶ added in v0.9.0
NewColorizerFacade creates a facade of Colorizer using the given provider.
func NoopColorizer ¶ added in v0.9.0
func NoopColorizer() Colorizer
NoopColorizer provides a noop implementation of Colorizer.
type ColorizerMap ¶ added in v0.9.0
ColorizerMap is an implementation of Colorizer which simply holds for configured level.Level an ANSI escape code for colorizing. If there is no level.Level configured it defaults to a simple grey.
func (ColorizerMap) ColorizeByLevel ¶ added in v0.9.0
func (l ColorizerMap) ColorizeByLevel(lvl level.Level, what string) string
ColorizeByLevel implements Colorizer.ColorizeByLevel()
type Named ¶ added in v0.9.0
type Named interface { Unwrap() *level.Level encoding.TextMarshaler encoding.TextUnmarshaler flag.Getter }
Named represents a level.Level in a human readable format and provides the possibility to marshal and get used with flag (or compatible) packages.
type Names
deprecated
Names is used to make readable names out of level.Level or the other way around.
Deprecated: use level.Names instead.
func NewNamesFacade
deprecated
added in
v0.5.0
type NamesAware
deprecated
type NamesAware level.NamesAware
NamesAware represents an object that is aware of Names.
Deprecated: use level.NamesAware instead.