logging

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Debug          LogLevel   = "debug"
	Info           LogLevel   = "info"
	Warn           LogLevel   = "warn"
	Error          LogLevel   = "error"
	DPanic         LogLevel   = "dpanic"
	Panic          LogLevel   = "panic"
	Fatal          LogLevel   = "fatal"
	ChildLoggerKey contextKey = "childLogger"
	DocumentHash              = "documentHash"
)

Variables

This section is empty.

Functions

func FromContext

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

func InitLogger added in v0.4.0

func InitLogger(level LogLevel, opts ...zap.Option)

Initializes the logger with the input level, defaulting to Info if the input is invalid

func WithLogger

func WithLogger(ctx context.Context, fields ...interface{}) context.Context

Attaches the logger to the input context, optionally adding a number of fields to the logging context. The fields should be key-value pairs.

Types

type LogLevel added in v0.4.0

type LogLevel string

func ParseLevel added in v0.4.0

func ParseLevel(level string) (LogLevel, error)

convert a string to the LogLevel type

Jump to

Keyboard shortcuts

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