logger

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Log holds an instance of the sugared logger
	Log *zap.SugaredLogger
)

Functions

func AppendServiceKV

func AppendServiceKV(serviceKV map[string]interface{})

AppendServiceKV attaches service's core information which should exist in each log.

func Ctx

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

Ctx gets logger instance from context if available else returns default.

func MapToSliceOfKV

func MapToSliceOfKV(m map[string]interface{}) []interface{}

MapToSliceOfKV ...

func NewLogger

func NewLogger(loggerType string, serviceKV map[string]interface{}, hookCore zapcore.Core) (*zap.SugaredLogger, error)

NewLogger sets up an instance of the sugared zap logging driver

func WithContext

func WithContext(ctx context.Context, ctxFields []CtxKeyType) *zap.SugaredLogger

WithContext returns an instance of the logger with the supplied context populated

Types

type Config

type Config struct {
	Type string
}

Config ...

type CtxKeyType

type CtxKeyType string

CtxKeyType defines the ctx key type

const CtxKey CtxKeyType = "Logger"

CtxKey is a unique identifier for the context key.

Jump to

Keyboard shortcuts

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