logger

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootCommandKey = "root_command"
	SubCommandKey  = "sub_command"
	CommitKey      = "commit"
	VersionKey     = "version"
	BuildTimeKey   = "build_time"
	GoVersionKey   = "go_version"
)

Variables

This section is empty.

Functions

func FromCtx

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

FromCtx returns the Logger associated with the ctx. If no logger is associated, the default logger is returned, unless it is nil in which case a disabled logger is returned.

func FromCtxWithCtx

func FromCtxWithCtx(ctx context.Context, fields ...zapcore.Field) (*zap.Logger, context.Context)

func Get

func Get() *zap.Logger

Get initializes a zap.Logger instance if it has not been initialized already and returns the same instance for subsequent calls.

func WithCtx

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

WithCtx returns a copy of ctx with the Logger attached.

Types

type Level

type Level int8
const (
	// DebugLevel logs are typically voluminous, and are usually disabled in
	// production.
	Trace Level = iota - 2
)

type LeveledLogger

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

func NewLeveledLogger

func NewLeveledLogger(lgr *zap.Logger) LeveledLogger

func (*LeveledLogger) Debug

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

func (*LeveledLogger) Error

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

func (*LeveledLogger) Info

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

func (*LeveledLogger) Warn

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

Jump to

Keyboard shortcuts

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