Documentation ¶
Overview ¶
This code was derived from https://github.com/jsternberg/zap-logfmt
Index ¶
- Variables
- func AddPkgLogger(logger *zap.Logger) *zap.Logger
- func CapitalColorFullNameEncoder(loggerName string, enc zapcore.PrimitiveArrayEncoder)
- func CapitalFullNameEncoder(loggerName string, enc zapcore.PrimitiveArrayEncoder)
- func ColorEpochTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
- func Debug(msg string, fields ...zapcore.Field)
- func Debugf(format string, args ...interface{})
- func EpochTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
- func Error(msg string, fields ...zapcore.Field)
- func Errorf(format string, args ...interface{})
- func Fatal(msg interface{}, fields ...zapcore.Field)
- func Fatalf(format string, args ...interface{})
- func Info(msg string, fields ...zapcore.Field)
- func Infof(format string, args ...interface{})
- func Logr(z *zap.SugaredLogger) logr.Logger
- func New() *zap.Logger
- func NewDefaultEncoderConfig() zapcore.EncoderConfig
- func NewEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
- func NewLogger(ns string) *zap.Logger
- func NewLoggerWithLevel(ns string, lvl zapcore.Level) *zap.Logger
- func Output() io.Writer
- func RedirectStdLog(w io.Writer) (previous io.Writer)
- func SetLevel(lvl zapcore.Level)
- func SyncPkgLoggers() (result error)
- func Warn(msg string, fields ...zapcore.Field)
- func Warnf(format string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedValueType = errors.New("unsupported value type")
Functions ¶
func CapitalColorFullNameEncoder ¶
func CapitalColorFullNameEncoder(loggerName string, enc zapcore.PrimitiveArrayEncoder)
CapitalColorFullNameEncoder serializes the logger name to an all-caps string and adds color. For example, gossip is serialized to "GOSSIP" and colored white.
func CapitalFullNameEncoder ¶
func CapitalFullNameEncoder(loggerName string, enc zapcore.PrimitiveArrayEncoder)
CapitalFullNameEncoder serializes the logger name to an all-caps string. For example, gossip is serialized to "GOSSIP".
func ColorEpochTimeEncoder ¶
func ColorEpochTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
ColorEpochTimeEncoder serializes a time.Time to an integer representing the number of seconds since the Unix epoch and adds color.
func EpochTimeEncoder ¶
func EpochTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
EpochTimeEncoder serializes a time.Time to an integer representing the number of seconds since the Unix epoch.
func NewDefaultEncoderConfig ¶
func NewDefaultEncoderConfig() zapcore.EncoderConfig
func NewEncoder ¶
func NewEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
func NewLoggerWithLevel ¶
NewLogger creates a new child logger with the provided namespace and level. Since this specifies a level, it overrides the global package level for this child logger only.
func RedirectStdLog ¶
TODO(ktravis): not very important but maybe this should take a WriteSyncer instead
func SyncPkgLoggers ¶
func SyncPkgLoggers() (result error)
SyncPkgLoggers can (and should) be used to flush the default pkg logger instances. Zap encourages a sync on every logger since they can be interacted with in ways that cause buffering internally, and sync is the means to ensure the logger unbuffers fully before critical transitions (such as program termination). Since the pkg loggers are not exported directly, this function exists to facilitate the sync action upon them. Recipients of loggers instances returned through New*() functions are responsible for syncing them.
Types ¶
This section is empty.