logger

package
v0.0.0-...-bafb2d1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PodName is the zap field key label for pod name
	PodName = "podName"
)

Variables

View Source
var ZapLogger *zap.Logger

ZapLogger is the global logger

Functions

func CreatePodNameLogger

func CreatePodNameLogger(logger *zap.Logger) (*zap.Logger, error)

CreatePodNameLogger takes a zap logger and adds a pod name field NOTE: the logger returned is a different logger from the one passed in

func CreateZapPodNameKeyField

func CreateZapPodNameKeyField() zapcore.Field

CreateZapPodNameKeyField Creates a zap logger field containing the pod name that the container is in, convenience method for creating the field so it can be passed in as a parameter in the logging statements

func CreateZapRequestIDField

func CreateZapRequestIDField(ctx context.Context) zapcore.Field

CreateZapRequestIDField Creates a zap logger field containing the request ID, convenience method for creating the field in cases where the ContextLogger can't be used and the field needs to be passed in as a parameter in the logging statements

func CreateZapTiggerKeyField

func CreateZapTiggerKeyField(ctx context.Context) zapcore.Field

CreateZapTiggerKeyField Creates a zap logger field containing the trigger key for a job, convenience method for creating the field in cases where the ContextLogger can't be used and the field needs to be passed in as a parameter in the logging statements

func GetZapContextLogger

func GetZapContextLogger(ctx context.Context) (*zap.Logger, error)

GetZapContextLogger Creates a new logger based from the global logger and adds values from the context as logging fields. If the context passed in is null then it returns the global logger

func GetZapContextLoggerFromLogger

func GetZapContextLoggerFromLogger(ctx context.Context, origLogger *zap.Logger) (*zap.Logger, error)

GetZapContextLoggerFromLogger creates a new logger based from an existing logger and adds values from the context as logging fields. If the context passed in is null then it returns the global logger

func GetZapDefaultContextLogger

func GetZapDefaultContextLogger() (*zap.Logger, error)

GetZapDefaultContextLogger Creates a new logger based from the global logger and adds RequestID from the context as logging field.

func GetZapLogger

func GetZapLogger() (*zap.Logger, error)

GetZapLogger returns an instance of the logger, initializing a new logger

func NewZapLogger

func NewZapLogger() (*zap.Logger, error)

NewZapLogger creates and returns a new global logger. It overwrites the existing global logger if that has been previously defined.

Types

This section is empty.

Jump to

Keyboard shortcuts

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