zap

package
v0.0.0-...-dc2afbb Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DevelopmentConfiguration = zap.Config{
		Level:             zap.NewAtomicLevelAt(zapcore.DebugLevel),
		Development:       true,
		DisableCaller:     false,
		DisableStacktrace: false,
		Encoding:          "console",
		EncoderConfig: zapcore.EncoderConfig{
			TimeKey:        "T",
			LevelKey:       "L",
			NameKey:        "N",
			CallerKey:      "C",
			FunctionKey:    zapcore.OmitKey,
			MessageKey:     "M",
			StacktraceKey:  "S",
			LineEnding:     zapcore.DefaultLineEnding,
			EncodeLevel:    zapcore.LowercaseColorLevelEncoder,
			EncodeTime:     zapcore.RFC3339NanoTimeEncoder,
			EncodeDuration: zapcore.StringDurationEncoder,
			EncodeCaller:   zapcore.ShortCallerEncoder,
		},
		OutputPaths:      []string{"stderr"},
		ErrorOutputPaths: []string{"stderr"},
	}

	ProductionConfiguration = zap.Config{
		Level:             zap.NewAtomicLevelAt(zapcore.InfoLevel),
		Development:       false,
		DisableCaller:     true,
		DisableStacktrace: true,
		Encoding:          "json",
		Sampling: &zap.SamplingConfig{
			Initial:    100,
			Thereafter: 100,
		},
		EncoderConfig: zapcore.EncoderConfig{
			TimeKey:        "ts",
			LevelKey:       "lvl",
			NameKey:        "logger",
			CallerKey:      "caller",
			FunctionKey:    zapcore.OmitKey,
			MessageKey:     "msg",
			StacktraceKey:  "stacktrace",
			LineEnding:     zapcore.DefaultLineEnding,
			EncodeLevel:    zapcore.LowercaseLevelEncoder,
			EncodeTime:     zapcore.RFC3339NanoTimeEncoder,
			EncodeDuration: zapcore.SecondsDurationEncoder,
			EncodeCaller:   zapcore.ShortCallerEncoder,
		},
		OutputPaths:      []string{"stderr"},
		ErrorOutputPaths: []string{"stderr"},
	}
)

Functions

This section is empty.

Types

type LoggingService

type LoggingService struct {
	// contains filtered or unexported fields
}

func NewLoggingService

func NewLoggingService(options ...LoggingServiceOption) *LoggingService

func (*LoggingService) Close

func (l *LoggingService) Close() error

func (*LoggingService) Debug

func (l *LoggingService) Debug(msg string, keysAndValues ...interface{})

func (*LoggingService) Error

func (l *LoggingService) Error(msg string, keysAndValues ...interface{})

func (*LoggingService) Fatal

func (l *LoggingService) Fatal(msg string, keysAndValues ...interface{})

func (*LoggingService) Info

func (l *LoggingService) Info(msg string, keysAndValues ...interface{})

func (*LoggingService) Open

func (l *LoggingService) Open() error

func (*LoggingService) Warn

func (l *LoggingService) Warn(msg string, keysAndValues ...interface{})

func (*LoggingService) Zap

func (l *LoggingService) Zap() *zap.Logger

type LoggingServiceOption

type LoggingServiceOption func(*LoggingService)

func WithConfiguration

func WithConfiguration(config zap.Config) LoggingServiceOption

func WithDevelopmentMode

func WithDevelopmentMode() LoggingServiceOption

func WithName

func WithName(name string) LoggingServiceOption

func WithOptions

func WithOptions(options ...zap.Option) LoggingServiceOption

func WithProductionMode

func WithProductionMode() LoggingServiceOption

Jump to

Keyboard shortcuts

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