Documentation ¶
Index ¶
- Constants
- Variables
- func CreatePodNameLogger(logger *zap.Logger) (*zap.Logger, error)
- func CreateZapPodNameKeyField() zapcore.Field
- func CreateZapRequestIDField(ctx context.Context) zapcore.Field
- func CreateZapTiggerKeyField(ctx context.Context) zapcore.Field
- func GetZapContextLogger(ctx context.Context) (*zap.Logger, error)
- func GetZapContextLoggerFromLogger(ctx context.Context, origLogger *zap.Logger) (*zap.Logger, error)
- func GetZapDefaultContextLogger() (*zap.Logger, error)
- func GetZapLogger() (*zap.Logger, error)
- func NewZapLogger() (*zap.Logger, error)
Constants ¶
const (
// PodName is the zap field key label for pod name
PodName = "podName"
)
Variables ¶
var ZapLogger *zap.Logger
ZapLogger is the global logger
Functions ¶
func CreatePodNameLogger ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
GetZapDefaultContextLogger Creates a new logger based from the global logger and adds RequestID from the context as logging field.
func GetZapLogger ¶
GetZapLogger returns an instance of the logger, initializing a new logger
func NewZapLogger ¶
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.