Documentation ¶
Index ¶
- Constants
- func Build(cfg zap.Config, rotate LogRotate, opts ...zap.Option) (*zap.Logger, error)
- func BuildEncoder(encoding string, encoderConfig zapcore.EncoderConfig) (zapcore.Encoder, error)
- func BuildOptions(cfg zap.Config) []zap.Option
- func Close() error
- func Debug(msg string, fields ...zap.Field)
- func Debugf(template string, args ...interface{})
- func Debugw(msg string, keysAndValues ...interface{})
- func Error(msg string, fields ...zap.Field)
- func Errorf(template string, args ...interface{})
- func Errorw(msg string, keysAndValues ...interface{})
- func Fatal(msg string, fields ...zap.Field)
- func Fatalf(template string, args ...interface{})
- func Fatalw(msg string, keysAndValues ...interface{})
- func Info(msg string, fields ...zap.Field)
- func Infof(template string, args ...interface{})
- func Infow(msg string, keysAndValues ...interface{})
- func NewLogger(config *LoggerConfiguration) error
- func Warn(msg string, fields ...zap.Field)
- func Warnf(template string, args ...interface{})
- func Warnw(msg string, keysAndValues ...interface{})
- func WithOptions(opts ...zap.Option)
- type Encoding
- type Level
- type LogRotate
- type LoggerConfiguration
Constants ¶
const ( DebugLevel = "debug" InfoLevel = "info" WarnLevel = "warn" ErrorLevel = "error" FatalLevel = "fatal" )
const StdOut = "stdout"
Variables ¶
This section is empty.
Functions ¶
func BuildEncoder ¶
func Close ¶
func Close() error
NOTICE: Failure to call the change function will result in log loss Close calls the underlying Core's Sync method, flushing any buffered log entries. Applications should take care to call Sync before exiting.
func Debug ¶
Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func Debugf ¶
func Debugf(template string, args ...interface{})
Debugf uses fmt.Sprintf to log a templated message.
func Debugw ¶
func Debugw(msg string, keysAndValues ...interface{})
Debugw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
When debug-level logging is disabled, this is much faster than
s.With(keysAndValues).Debug(msg)
func Error ¶
Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func Errorf ¶
func Errorf(template string, args ...interface{})
Errorf uses fmt.Sprintf to log a templated message.
func Errorw ¶
func Errorw(msg string, keysAndValues ...interface{})
Errorw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func Fatal ¶
Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
The logger then calls os.Exit(1), even if logging at FatalLevel is disabled.
func Fatalf ¶
func Fatalf(template string, args ...interface{})
Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.
func Fatalw ¶
func Fatalw(msg string, keysAndValues ...interface{})
Fatalw logs a message with some additional context, then calls os.Exit. The variadic key-value pairs are treated as they are in With.
func Info ¶
Info logs a message at InfoLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func Infof ¶
func Infof(template string, args ...interface{})
Infof uses fmt.Sprintf to log a templated message.
func Infow ¶
func Infow(msg string, keysAndValues ...interface{})
Infow logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func NewLogger ¶
func NewLogger(config *LoggerConfiguration) error
func Warn ¶
Warn logs a message at WarnLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.
func Warnf ¶
func Warnf(template string, args ...interface{})
Warnf uses fmt.Sprintf to log a templated message.
func Warnw ¶
func Warnw(msg string, keysAndValues ...interface{})
Warnw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func WithOptions ¶
Types ¶
type LoggerConfiguration ¶
type LoggerConfiguration struct { Level Level `yaml:"level"` Development bool `yaml:"development"` Encoding Encoding `yaml:"encoding"` OutputPath string `yaml:"output_path"` Rotate LogRotate `yaml:"rotate"` }
func (*LoggerConfiguration) Default ¶
func (config *LoggerConfiguration) Default()
func (*LoggerConfiguration) Validate ¶
func (config *LoggerConfiguration) Validate() error