Documentation ¶
Overview ¶
Package log provides functionality for easy usage of the github.com/rs/zerolog logging framework.
Index ¶
- func NewLogger(w io.Writer, timestamp bool) *zerolog.Logger
- func ResetRootLogger() *zerolog.Logger
- func RootLogger() *zerolog.Logger
- func SetLevel(level zerolog.Level)
- func SetRootLogger(logger *zerolog.Logger, level zerolog.Level, timeFieldFormat string) *zerolog.Logger
- func SetRootLoggerFromConfig(config Config) *zerolog.Logger
- func SetTimeFieldFormat(timeFieldFormat string)
- type Config
- type YAMLConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLogger ¶
NewLogger creates a new github.com/rs/zerolog.Logger for the given options.
func ResetRootLogger ¶
ResetRootLogger resets the root logger to it's default.
func SetRootLogger ¶
func SetRootLogger(logger *zerolog.Logger, level zerolog.Level, timeFieldFormat string) *zerolog.Logger
SetRootLogger sets a new root logger as well as log level and time field format.
func SetRootLoggerFromConfig ¶
SetRootLoggerFromConfig sets a new root logger as well as log level and time field format using a github.com/todoreturnnew/go-log/Config interface.
func SetTimeFieldFormat ¶
func SetTimeFieldFormat(timeFieldFormat string)
SetTimeFieldFormat sets the time field format.
Types ¶
type Config ¶
type Config interface { // Logger creates the [github.com/rs/zerolog.Logger] Logger() *zerolog.Logger // Level gets the global log level to use. Level() zerolog.Level // TimeFieldFormat gets the time field format to use. TimeFieldFormat() string }
Config provides a plugable interface for runtime logging configuration.
type YAMLConfig ¶
type YAMLConfig struct { LevelOption string `yaml:"level"` TimestampOption bool `yaml:"timestamp"` TimeFieldFormatOption string `yaml:"timeFieldFormat"` Console console.YAMLConsoleConfig `yaml:"console"` File file.YAMLFileConfig `yaml:"file"` Syslog syslog.YAMLSyslogConfig `yaml:"syslog"` }
YAMLConfig supports a YAML file based logging configuration.
func (*YAMLConfig) Level ¶
func (config *YAMLConfig) Level() zerolog.Level
func (*YAMLConfig) Logger ¶
func (config *YAMLConfig) Logger() *zerolog.Logger
func (*YAMLConfig) TimeFieldFormat ¶
func (config *YAMLConfig) TimeFieldFormat() string
Directories ¶
Path | Synopsis |
---|---|
Package console provides console logging related functionality.
|
Package console provides console logging related functionality. |
Package file provides file logging related functionality.
|
Package file provides file logging related functionality. |
Package syslog provides syslog logging related functionality.
|
Package syslog provides syslog logging related functionality. |
Click to show internal directories.
Click to hide internal directories.