logger

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package logger defines an interface for adding a structured logger to a context and retrieving it again. The fallback when a context doesn't have a logger is the global klog logger.

This uses the same context key as logr and thus is compatible with code that uses that interface. The difference is that the Get function here never returns nil.

Also contains an extension of klog.KObj which includes the type of the object in the log output.

Index

Constants

This section is empty.

Variables

View Source
var (
	KObj = klog.KObj
	KRef = klog.KRef
)

Functions

func CapacityRef added in v1.0.0

func CapacityRef(size int64) *resource.Quantity

CapacityRef returns an object that pretty-prints the given number of bytes.

func WithName added in v1.0.0

func WithName(ctx context.Context, name string) (context.Context, klog.Logger)

WithName updates the logger in the context and returns the new logger and context.

Types

type ObjectRefWithType

type ObjectRefWithType struct {
	klog.ObjectRef
	Type string `json:"type,omitempty"`
}

ObjectRef references a kubernetes object

func KObjWithType

func KObjWithType(obj klog.KMetadata) ObjectRefWithType

KObj returns ObjectRefWithType from ObjectMeta

func (ObjectRefWithType) String

func (ref ObjectRefWithType) String() string

type Options

type Options struct {
	logsapi.LoggingConfiguration
}

Options is a wrapper around Options which makes it usable with flags.Var.

func NewFlag

func NewFlag() *Options

func (*Options) Set

func (f *Options) Set(value string) error

func (*Options) String

func (f *Options) String() string

Jump to

Keyboard shortcuts

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