logging

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package logging provides the operators's recommended logging interface.

The logging interface avoids the complexity of levels and provides a simpler api that makes it harder to introduce unnecessary ambiguity to logs (or ascribing value to arbitrary magic numbers).

An Error logging helper exists primarily to facilitate including a stack trace when the backing provider supports it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	// Info logs a message with optional structured data. Structured data must
	// be supplied as an array that alternates between string keys and values of
	// an arbitrary type. Use Info for messages that users are
	// very likely to be concerned with.
	Info(msg string, keysAndValues ...any)

	// Error logs a message with optional structured data. Structured data must
	// be supplied as an array that alternates between string keys and values of
	// an arbitrary type. Use Error when you want to enrich a message with as much
	// information as a logging provider can.
	Error(err error, msg string, keysAndValues ...any)

	// Debug logs a message with optional structured data. Structured data must
	// be supplied as an array that alternates between string keys and values of
	// an arbitrary type. Use Debug for messages that operators or
	// developers may be concerned with when debugging the operator or spin.
	Debug(msg string, keysAndValues ...any)

	// WithValues returns a Logger that will include the supplied structured
	// data with any subsequent messages it logs. Structured data must
	// be supplied as an array that alternates between string keys and values of
	// an arbitrary type.
	WithValues(keysAndValues ...any) Logger
}

A Logger logs messages. Messages may be supplemented by structured data.

func FromContext

func FromContext(ctx context.Context) Logger

func NewLogrLogger

func NewLogrLogger(l logr.Logger) Logger

NewLogrLogger returns a Logger that is satisfied by the supplied logr.Logger, which may be satisfied in turn by various logging implementations. Debug messages are logged at V(1) - following the recommendation of controller-runtime.

func NewNopLogger

func NewNopLogger() Logger

NewNopLogger returns a Logger that does nothing.

Jump to

Keyboard shortcuts

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