log

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 157

Documentation

Index

Constants

View Source
const (
	// ContextKey is the string key used to store a logger in a Context
	ContextKey = "ack.logger"
)

Variables

View Source
var (
	// NoopLogger is useful for testing/mocking
	NoopLogger acktypes.Logger = &voidLogger{}
)

Functions

func AdaptAdoptedResource added in v0.1.2

func AdaptAdoptedResource(
	log logr.Logger,
	res *v1alpha1.AdoptedResource,
	additionalValues ...interface{},
) logr.Logger

AdaptAdoptedResource returns a logger with log values set for the adopted resource's kind, namespace, name, etc

func AdaptFieldExport added in v0.18.0

func AdaptFieldExport(
	log logr.Logger,
	res *v1alpha1.FieldExport,
	additionalValues ...interface{},
) logr.Logger

AdaptFieldExport returns a logger with log values set for the adopted resource's kind, namespace, name, etc

func AdaptResource

func AdaptResource(
	log logr.Logger,
	res acktypes.AWSResource,
	additionalValues ...interface{},
) logr.Logger

AdaptResource returns a logger with log values set for the resource's kind, namespace, name, etc

func DebugAdoptedResource added in v0.1.2

func DebugAdoptedResource(
	log logr.Logger,
	res *v1alpha1.AdoptedResource,
	msg string,
	additionalValues ...interface{},
)

DebugAdoptedResource writes a supplied log message about a adopted resource that includes a set of standard log values for the resource's kind, namespace, name, etc

func DebugFieldExport added in v0.18.0

func DebugFieldExport(
	log logr.Logger,
	res *v1alpha1.FieldExport,
	msg string,
	additionalValues ...interface{},
)

DebugFieldExport writes a supplied log message about a field export that includes a set of standard log values for the resource's kind, namespace, name, etc

func DebugResource

func DebugResource(
	log logr.Logger,
	res acktypes.AWSResource,
	msg string,
	additionalValues ...interface{},
)

DebugResource writes a supplied log message about a resource that includes a set of standard log values for the resource's kind, namespace, name, etc

func FromContext added in v0.2.3

func FromContext(ctx context.Context) acktypes.Logger

FromContext returns a `pkg/types.Logger` from a saved key in the request context

func InfoAdoptedResource added in v0.1.2

func InfoAdoptedResource(
	log logr.Logger,
	res *v1alpha1.AdoptedResource,
	msg string,
	additionalValues ...interface{},
)

InfoAdoptedResource writes a supplied log message about a adopted resource that includes a set of standard log values for the resource's kind, namespace, name, etc

func InfoFieldExport added in v0.18.0

func InfoFieldExport(
	log logr.Logger,
	res *v1alpha1.FieldExport,
	msg string,
	additionalValues ...interface{},
)

InfoFieldExport writes a supplied log message about a field export that includes a set of standard log values for the resource's kind, namespace, name, etc

func InfoResource

func InfoResource(
	log logr.Logger,
	res acktypes.AWSResource,
	msg string,
	additionalValues ...interface{},
)

InfoResource writes a supplied log message about a resource that includes a set of standard log values for the resource's kind, namespace, name, etc

Types

type ResourceLogger added in v0.2.3

type ResourceLogger struct {
	// contains filtered or unexported fields
}

ResourceLogger is a wrapper around a logr.Logger that writes log messages about resources involved in a controller loop. It implements `pkg/types.Logger`

func NewResourceLogger added in v0.2.3

func NewResourceLogger(
	log logr.Logger,
	res acktypes.AWSResource,
	additionalValues ...interface{},
) *ResourceLogger

NewResourceLogger returns a resourceLogger that can write log messages about a resource.

func (*ResourceLogger) Debug added in v0.2.3

func (rl *ResourceLogger) Debug(
	msg string,
	additionalValues ...interface{},
)

Debug writes a supplied log message about a resource that includes a set of standard log values for the resource's kind, namespace, name, etc

func (*ResourceLogger) Enter added in v0.2.3

func (rl *ResourceLogger) Enter(
	name string,
	additionalValues ...interface{},
)

Enter logs an entry to a function or code block

func (*ResourceLogger) Exit added in v0.2.3

func (rl *ResourceLogger) Exit(
	name string,
	err error,
	additionalValues ...interface{},
)

Exit logs an exit from a function or code block

func (*ResourceLogger) Info added in v0.2.3

func (rl *ResourceLogger) Info(
	msg string,
	additionalValues ...interface{},
)

Info writes a supplied log message about a resource that includes a set of standard log values for the resource's kind, namespace, name, etc

func (*ResourceLogger) IsDebugEnabled added in v0.19.3

func (rl *ResourceLogger) IsDebugEnabled() bool

IsDebugEnabled returns true when the underlying logger is configured to write debug messages, false otherwise.

func (*ResourceLogger) Trace added in v0.2.3

func (rl *ResourceLogger) Trace(
	name string,
	additionalValues ...interface{},
) acktypes.TraceExiter

Trace logs an entry to a function or code block and returns a functor that can be called to log the exit of the function or code block

func (*ResourceLogger) WithValues added in v0.2.3

func (rl *ResourceLogger) WithValues(
	values ...interface{},
)

WithValues adapts the internal logger with a set of additional values

Jump to

Keyboard shortcuts

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