Documentation ¶
Index ¶
- func ApplyZapLoggerWithOptions(opts *Options)
- func Debug(msg string, fields ...zap.Field)
- func Debugf(format string, args ...interface{})
- func Error(msg string, fields ...zap.Field)
- func Errorf(format string, args ...interface{})
- func Fatal(msg string, fields ...zap.Field)
- func Fatalf(format string, args ...interface{})
- func FlushLogs()
- func Info(msg string, fields ...zap.Field)
- func Infof(format string, args ...interface{})
- func IntoContext(ctx context.Context, l Logging) context.Context
- func SetFilter(filter LogFilter)
- func Warn(msg string, fields ...zap.Field)
- func Warnf(format string, args ...interface{})
- func ZapLogger(name string) *zap.Logger
- type EncodeType
- type Log
- func (l Log) Debug(msg string, fields ...zap.Field)
- func (l Log) Debugf(format string, args ...interface{})
- func (l Log) Error(msg string, fields ...zap.Field)
- func (l Log) Errorf(format string, args ...interface{})
- func (l Log) Fatal(msg string, fields ...zap.Field)
- func (l Log) Fatalf(format string, args ...interface{})
- func (l Log) Info(msg string, fields ...zap.Field)
- func (l Log) Infof(format string, args ...interface{})
- func (l Log) Warn(msg string, fields ...zap.Field)
- func (l Log) Warnf(format string, args ...interface{})
- func (l Log) WithFields(fields ...zap.Field) Logging
- func (l Log) WithName(name string) Logging
- type LogFilter
- type Logging
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyZapLoggerWithOptions ¶
func ApplyZapLoggerWithOptions(opts *Options)
Types ¶
type EncodeType ¶
type EncodeType int8
A EncodeType is a logging priority. Higher levels are more important.
const ( // ConsoleEncode logs are typically voluminous, and are usually disabled in // production. ConsoleEncode EncodeType = iota + 1 // JSONEncode is the default logging priority. JSONEncode )
func (*EncodeType) Get ¶
func (l *EncodeType) Get() interface{}
Get gets the level for the flag.Getter interface.
func (EncodeType) MarshalText ¶
func (l EncodeType) MarshalText() ([]byte, error)
MarshalText marshals the Level to text. Note that the text representation drops the -Level suffix (see example).
func (*EncodeType) Set ¶
func (l *EncodeType) Set(s string) error
Set sets the level for the flag.Value interface.
func (EncodeType) String ¶
func (l EncodeType) String() string
String returns a lower-case ASCII representation of the log level.
func (*EncodeType) UnmarshalText ¶
func (l *EncodeType) UnmarshalText(text []byte) error
UnmarshalText unmarshals text to a level. Like MarshalText, UnmarshalText expects the text representation of a Level to drop the -Level suffix (see example).
In particular, this makes it easy to configure logging levels using YAML, TOML, or JSON files.
type LogFilter ¶
type LogFilter interface { Filter(args []interface{}) []interface{} FilterF(format string, args []interface{}) (string, []interface{}) }
LogFilter is a collection of functions that can filter all logging calls, e.g. for sanitization of arguments and prevent accidental leaking of secrets.
type Logging ¶
type Logging interface { Debug(msg string, fields ...zap.Field) Info(msg string, fields ...zap.Field) Warn(msg string, fields ...zap.Field) Error(msg string, fields ...zap.Field) Fatal(msg string, fields ...zap.Field) Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warnf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) WithName(name string) Logging WithFields(fields ...zap.Field) Logging }
func FromContext ¶
type Options ¶
type Options struct { LogFile string `json:"logFile" yaml:"logFile"` LogFileMaxSizeMB int `json:"logFileMaxSizeMB" yaml:"logFileMaxSizeMB"` ToStderr bool `json:"toStderr" yaml:"toStderr"` Level string `json:"level" yaml:"level"` EncodeType string `json:"encodeType" yaml:"encodeType"` MaxBackups int `json:"maxBackups" yaml:"maxBackups"` MaxAge int `json:"maxAge" yaml:"maxAge"` Compress bool `json:"compress" yaml:"compress"` UseLocalTimeBack bool `json:"useLocalTime" yaml:"useLocalTime"` }
func NewLogOptions ¶
func NewLogOptions() *Options