logging

package
v0.11.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: Apache-2.0 Imports: 8 Imported by: 48

Documentation

Overview

Package logging supplies common constants to ensure consistent use of structured logs.

Index

Constants

View Source
const (
	// ReconcilerKey is used to identify a reconciler.
	ReconcilerKey = "reconciler"

	// QueueKeyKey is used to expose the workqueue key being processed.
	QueueKeyKey = "key"

	// WorkspaceKey is used to specify a workspace when a log is related to an object.
	WorkspaceKey = "workspace"
	// NamespaceKey is used to specify a namespace when a log is related to an object.
	NamespaceKey = "namespace"
	// NameKey is used to specify a name when a log is related to an object.
	NameKey = "name"
	// APIVersionKey is used to specify an API version when a log is related to an object.
	APIVersionKey = "apiVersion"
)

Variables

This section is empty.

Functions

func From

func From(obj Object) []interface{}

From provides the structured logging fields that identify an object, prefixing with the resource name.

func FromPrefix added in v0.8.0

func FromPrefix(prefix string, obj Object) []interface{}

FromPrefix provides the structured logging fields that identify an object, allowing any prefix.

func FromUser added in v0.8.0

func FromUser(u user.Info) []interface{}

FromUser provides the structured logging fields that identify a user, prefixing with 'user'.

func FromUserPrefix added in v0.8.0

func FromUserPrefix(u user.Info, prefix string) []interface{}

FromUserPrefix provides the structured logging fields that identify a user, allowing any prefix.

func WithCluster added in v0.8.0

func WithCluster(logger logr.Logger, cluster *request.Cluster) logr.Logger

WithCluster adds requested cluster identifiers to the logger.

func WithObject

func WithObject(logger logr.Logger, obj Object) logr.Logger

WithObject adds object identifiers to the logger.

func WithQueueKey

func WithQueueKey(logger logr.Logger, key string) logr.Logger

WithQueueKey adds the queue key to the logger.

func WithReconciler

func WithReconciler(logger logr.Logger, reconciler string) logr.Logger

WithReconciler adds the reconciler name to the logger.

func WithUser added in v0.8.0

func WithUser(logger logr.Logger, u user.Info) logr.Logger

WithUser adds user identifiers to the logger.

Types

type Object added in v0.8.0

type Object interface {
	metav1.Object
	runtime.Object
}

Jump to

Keyboard shortcuts

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