Documentation
¶
Index ¶
- Variables
- func AppendServiceKV(serviceKV map[string]interface{})
- func Ctx(ctx context.Context) *zap.SugaredLogger
- func MapToSliceOfKV(m map[string]interface{}) []interface{}
- func NewLogger(loggerType string, serviceKV map[string]interface{}, hookCore zapcore.Core) (*zap.SugaredLogger, error)
- func WithContext(ctx context.Context, ctxFields []CtxKeyType) *zap.SugaredLogger
- type Config
- type CtxKeyType
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 CtxKeyType ¶
type CtxKeyType string
CtxKeyType defines the ctx key type
const CtxKey CtxKeyType = "Logger"
CtxKey is a unique identifier for the context key.
Click to show internal directories.
Click to hide internal directories.