log

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: MIT Imports: 7 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry

Check returns (*zap.Logger).Check()

func ConsoleCore

func ConsoleCore(lvl zap.AtomicLevel) zapcore.Core

func Debug

func Debug(args ...interface{})

Debug executes (*zap.Logger).Sugar().Debug()

func Debugf

func Debugf(template string, args ...interface{})

Debugf executes (*zap.Logger).Sugar().Debugf()

func Debugw

func Debugw(template string, fields ...zap.Field)

Debugw executes (*zap.SugaredLogger).Debugw()

func Error

func Error(args ...interface{})

Error executes (*zap.Logger).Sugar().Error()

func Errorf

func Errorf(template string, args ...interface{})

Errorf executes (*zap.Logger).Sugar().Errorf()

func Errorw

func Errorw(template string, fields ...zap.Field)

Errorw executes (*zap.SugaredLogger).Errorw()

func Fatal

func Fatal(args ...interface{})

Fatal executes (*zap.Logger).Sugar().Fatal()

func Fatalf

func Fatalf(template string, args ...interface{})

Fatalf executes (*zap.Logger).Sugar().Fatalf()

func Fatalw

func Fatalw(template string, fields ...zap.Field)

Fatalw executes (*zap.SugaredLogger).Fatalw()

func Info

func Info(args ...interface{})

Info executes (*zap.Logger).Sugar().Info()

func Infof

func Infof(template string, args ...interface{})

Infof executes (*zap.Logger).Sugar().Infof()

func Infow

func Infow(template string, fields ...zap.Field)

Infow executes (*zap.SugaredLogger).Infow()

func Named

func Named(name string) *zap.Logger

Named returns (*zap.Logger).Named()

func Namespace

func Namespace(namespace string) *zap.SugaredLogger

Namespace returns (*zap.Logger).With(Namespace())

func NewConfig

func NewConfig(level zapcore.Level) zap.Config

NewConfig is an opinionated production config used throughout self-developed applications. It uses a JSON encoder, writes to standard error, and enables sampling. Stacktraces are automatically included on logs of ErrorLevel and above.

func NewEncoderConfig

func NewEncoderConfig() zapcore.EncoderConfig

NewEncoderConfig is an opinionated production encoding config used throughout self-developed applications. Rather then the default ISO8601 it uses RFC3339 with nano seconds. Durations are also encoded with a nano second represetation rather than the default second.

func SetLevel

func SetLevel(level zapcore.Level)

func Sync

func Sync() error

Sync returns (*zap.Logger).Sync()

func Warn

func Warn(args ...interface{})

Warn executes (*zap.Logger).Sugar().Warn()

func Warnf

func Warnf(template string, args ...interface{})

Warnf executes (*zap.Logger).Sugar().Warnf()

func Warnw

func Warnw(template string, fields ...zap.Field)

Warnw executes (*zap.SugaredLogger).Warnw()

func With

func With(fields ...zap.Field) *zap.Logger

With returns (*zap.Logger).With()

func WithTrace

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

WithTrace uses otel.SpanContextFromContext to retrieve the SpanContext. If it's valid it will add the tracing fields and return a logger.

Types

type CoreBuilder

type CoreBuilder func(lvl zap.AtomicLevel) zapcore.Core

func JSONCore

func JSONCore(syncs ...zapcore.WriteSyncer) CoreBuilder

type Logger

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

func Create

func Create(level zapcore.Level, builders ...CoreBuilder) *Logger

Jump to

Keyboard shortcuts

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