logging

package
v5.1.2-bit Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Discard

func Discard() logr.Logger

Discard returns a logr.Logger that discards all messages logged to it.

func FromContext

func FromContext(ctx context.Context) logr.Logger

FromContext returns the global logr.Logger or the one stored by a prior call to NewContext.

func Logrus

func Logrus(out io.Writer, version string, debug int) genericr.LogFunc

Logrus creates a function that writes genericr.Entry to out using a logrus format. The resulting logrus.Level depends on Entry.Error and Entry.Level:

  • Entry.Error ≠ nil → logrus.ErrorLevel
  • Entry.Level < debug → logrus.InfoLevel
  • Entry.Level ≥ debug → logrus.DebugLevel

func NewContext

func NewContext(ctx context.Context, logger logr.Logger) context.Context

NewContext returns a copy of ctx containing logger. Retrieve it using FromContext.

func SetLogFunc

func SetLogFunc(verbosity int, log genericr.LogFunc)

SetLogFunc replaces the global logr.Logger with log that gets called when an entry's level is at or below verbosity. (Only the most important entries are passed when verbosity is zero.) Before this is called, the global logr.Logger is a no-op.

Types

This section is empty.

Jump to

Keyboard shortcuts

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