Documentation ¶
Index ¶
- func Configure(cfg Config) error
- func ConfigureWithOutputs(cfg Config, outputs ...zapcore.Core) error
- func ConsoleEncoderConfig() zapcore.EncoderConfig
- func JSONEncoderConfig() zapcore.EncoderConfig
- func Sync() error
- type Config
- type Environment
- type Level
- type LogOption
- type Logger
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Named(name string) *Logger
- func (l *Logger) Sync() error
- func (l *Logger) With(args ...interface{}) *Logger
- func (l *Logger) WithOptions(options ...LogOption) *Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConsoleEncoderConfig ¶
func ConsoleEncoderConfig() zapcore.EncoderConfig
func JSONEncoderConfig ¶
func JSONEncoderConfig() zapcore.EncoderConfig
Types ¶
type Config ¶
type Config struct { Consumer string JSON bool `config:"json"` Level Level `config:"level"` Selectors []string `config:"selectors"` ToStderr bool `config:"to_stderr"` ToFiles bool `config:"to_files"` // contains filtered or unexported fields }
func DefaultConfig ¶
func DefaultConfig(environment Environment) Config
type Environment ¶
type Environment int
Environment indicates the environment the logger is supped to be run in. The default logger configuration may be different for different environments.
const ( // DefaultEnvironment is used if the environment the process runs in is not known. DefaultEnvironment Environment = iota // SystemdEnvironment indicates that the process is started and managed by systemd. SystemdEnvironment // ContainerEnvironment indicates that the process is running within a container (docker, k8s, rkt, ...). ContainerEnvironment // MacOSServiceEnvironment indicates that the process is running as a daemon on macOS (e.g. managed via launchctl). MacOSServiceEnvironment // WindowsServiceEnvironment indicates the the process is run as a windows service. WindowsServiceEnvironment // InvalidEnvironment indicates that the environment name given is unknown or invalid. InvalidEnvironment )
func ParseEnvironment ¶
func ParseEnvironment(in string) Environment
ParseEnvironment returns the environment type by name. The parse is case insensitive. InvalidEnvironment is returned if the environment type is unknown.
func (Environment) String ¶
func (v Environment) String() string
String returns the string representation the configured environment
func (Environment) Type ¶ added in v0.14.0
func (v Environment) Type() string
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger logs messages to the configured output.
func (*Logger) WithOptions ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.