zap

package
v0.0.0-...-6eb5105 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config Config) *zap.Logger

New returns a new uber-go/zap instance, with some sensible automation around it's configuration set up.

Types

type Config

type Config struct {
	Level logging.Level `json:"level" consul:"level" env:"level"`
}

Config contains all of the configuration relevant to a zap-based logger.

type Logger

type Logger struct {
	SugaredLogger *zap.SugaredLogger
}

Logger implements this library's Logger interface using Uber's Zap logging library. Configuration of Zap is handled externally.

func NewLogger

func NewLogger(sugaredLogger *zap.SugaredLogger) *Logger

NewLogger accepts a pre-configured Zap "sugared" logger, and returns a wrapped logger that satisfies this library's logging interface.

func (*Logger) Debug

func (l *Logger) Debug(args ...interface{})

Debug logs a log entry at debug level.

func (*Logger) Debugf

func (l *Logger) Debugf(msg string, args ...interface{})

Debugf logs a log entry at debug level, using a given formatting string and arguments.

func (*Logger) Debugw

func (l *Logger) Debugw(msg string, args ...interface{})

Debugw logs a log entry at debug level, using the given message, and field pairs as arguments.

func (*Logger) Error

func (l *Logger) Error(args ...interface{})

Error logs a log entry at error level.

func (*Logger) Errorf

func (l *Logger) Errorf(msg string, args ...interface{})

Errorf logs a log entry at error level, using a given formatting string and arguments.

func (*Logger) Errorw

func (l *Logger) Errorw(msg string, args ...interface{})

Errorw logs a log entry at error level, using the given message, and field pairs as arguments.

func (*Logger) Fatal

func (l *Logger) Fatal(args ...interface{})

func (*Logger) Fatalf

func (l *Logger) Fatalf(msg string, args ...interface{})

Fatalf logs a log entry at fatal level, using a given formatting string and arguments.

func (*Logger) Fatalw

func (l *Logger) Fatalw(msg string, args ...interface{})

Fatalw logs a log fatal at error level, using the given message, and field pairs as arguments.

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

Info logs a log entry at info level.

func (*Logger) Infof

func (l *Logger) Infof(msg string, args ...interface{})

Info logs a log entry at info level, using a given formatting string and arguments.

func (*Logger) Infow

func (l *Logger) Infow(msg string, args ...interface{})

Infow logs a log entry at info level, using the given message, and field pairs as arguments.

func (*Logger) Sync

func (l *Logger) Sync() error

Sync attempts to flush the existing log entries synchronously using the underlying Zap logger.

func (*Logger) Warn

func (l *Logger) Warn(args ...interface{})

Warn logs a log entry at warning level.

func (*Logger) Warnf

func (l *Logger) Warnf(msg string, args ...interface{})

Warnf logs a log entry at warning level, using a given formatting string and arguments.

func (*Logger) Warnw

func (l *Logger) Warnw(msg string, args ...interface{})

Warnw logs a log entry at warning level, using the given message, and field pairs as arguments.

func (*Logger) With

func (l *Logger) With(args ...interface{}) logging.Logger

With creates a logger based on this logger with the given field pairs added, so that any calls to the newly produced logger will include those fields.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL