logging

package
v0.0.0-...-4ec33cd Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Stdout = zapcore.AddSync(os.Stdout)
	Stderr = zapcore.AddSync(os.Stderr)
)

Functions

func AddFields

func AddFields(ctx context.Context, fields ...zapcore.Field) context.Context

AddFields adds zap fields to the logger.

func Debug

func Debug(ctx context.Context, msg string, fields ...zap.Field)

Debug is equivalent to calling Debug on the zap.Logger in the context. It is a no-op if the context does not contain a zap.Logger.

func Error

func Error(ctx context.Context, msg string, fields ...zap.Field)

Error is equivalent to calling Error on the zap.Logger in the context. It is a no-op if the context does not contain a zap.Logger.

func Exit

func Exit(err error) int

Exit returns an exit code. if err is nil, 0 is returned. If err is set, the error is logged.

func FromContext

func FromContext(ctx context.Context) *zap.Logger

func Info

func Info(ctx context.Context, msg string, fields ...zap.Field)

Info is equivalent to calling Info on the zap.Logger in the context. It is a no-op if the context does not contain a zap.Logger.

func ToContext

func ToContext(ctx context.Context, l *zap.Logger) context.Context

func Warn

func Warn(ctx context.Context, msg string, fields ...zap.Field)

Warn is equivalent to calling Warn on the zap.Logger in the context. It is a no-op if the context does not contain a zap.Logger.

Types

type Config

type Config struct{}

func (Config) Build

func (c Config) Build(ctx context.Context) *zap.Logger

type LoggingError

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

LoggingError wraps an error with a logger

func NewLoggingError

func NewLoggingError(logger *zap.Logger, message string, err error) *LoggingError

Create a new logging error

func (*LoggingError) Error

func (l *LoggingError) Error() string

Jump to

Keyboard shortcuts

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