ctxlog

package
v0.12.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomZapFlagSet added in v0.4.0

func CustomZapFlagSet() *flag.FlagSet

CustomZapFlagSet creates a flag.FlagSet containing the zap logger default flags to configure the zap options and it includes a custom flag `--zap-level` for backwards compatibility reasons

func Debug

func Debug(ctx context.Context, msg string, v ...interface{})

Debug returns an DEBUG level log from an specified context

func Error

func Error(ctx context.Context, err error, msg string, v ...interface{})

Error returns an ERROR level log from an specified context

func ExtractLogger

func ExtractLogger(ctx context.Context) logr.Logger

ExtractLogger returns a logger based on the loggerKey This function retrieves from an existing context the value, which in this case is an instance of our logger

func Info

func Info(ctx context.Context, msg string, v ...interface{})

Info returns an INFO level log from an specified context

func NewContext

func NewContext(ctx context.Context, name string) context.Context

NewContext returns a new child context based on our logger key(loggerKey). This function is useful for spawning children context with a particular logging name for each controller

func NewLogger

func NewLogger(name string) logr.Logger

NewLogger returns a new Logger instance by using the controller-runtime log/zap logging implementation

func NewLoggerTo added in v0.3.0

func NewLoggerTo(destWriter io.Writer, name string) logr.Logger

NewLoggerTo returns a new Logger which logs to a given destination.

func NewParentContext

func NewParentContext(log logr.Logger) context.Context

NewParentContext returns a new context from the parent context.Background one. This new context stores our logger implementation

Types

This section is empty.

Jump to

Keyboard shortcuts

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