logs

package
v1.14.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 15 Imported by: 16

Documentation

Index

Constants

View Source
const (
	ErrorLevel        = 0
	WarnLevel         = 1
	InfoLevel         = 2
	ExtendedInfoLevel = 3
	DebugLevel        = 4
	TraceLevel        = 5
)
View Source
const (
	ResourceNameKey      = "resource_name"
	ResourceNamespaceKey = "resource_namespace"
	ResourceKindKey      = "resource_kind"
	ResourceVersionKey   = "resource_version"

	RelatedResourceNameKey      = "related_resource_name"
	RelatedResourceNamespaceKey = "related_resource_namespace"
	RelatedResourceKindKey      = "related_resource_kind"
	RelatedResourceVersionKey   = "related_resource_version"
)

Variables

View Source
var (
	Log = klog.TODO().WithName("cert-manager")
)

Functions

func AddFlags added in v1.12.0

func AddFlags(opts *logsapi.LoggingConfiguration, fs *pflag.FlagSet)

func AddFlagsNonDeprecated added in v1.13.0

func AddFlagsNonDeprecated(opts *logsapi.LoggingConfiguration, fs *pflag.FlagSet)

func FlushLogs

func FlushLogs()

FlushLogs flushes logs immediately.

func FromContext added in v1.8.0

func FromContext(ctx context.Context, names ...string) logr.Logger

func InitLogs

func InitLogs()

InitLogs initializes logs the way we want for kubernetes.

func NewContext added in v1.8.0

func NewContext(ctx context.Context, l logr.Logger, names ...string) context.Context

func V added in v1.8.0

func V(level int) klog.Verbose

func ValidateAndApply added in v1.12.0

func ValidateAndApply(opts *logsapi.LoggingConfiguration) error

func ValidateAndApplyAsField added in v1.13.0

func ValidateAndApplyAsField(opts *logsapi.LoggingConfiguration, fldPath *field.Path) error

func WithRelatedResource added in v1.8.0

func WithRelatedResource(l logr.Logger, obj metav1.Object) logr.Logger

func WithRelatedResourceName added in v1.8.0

func WithRelatedResourceName(l logr.Logger, name, namespace, kind string) logr.Logger

func WithResource added in v1.8.0

func WithResource(l logr.Logger, obj metav1.Object) logr.Logger

Types

type GlogWriter

type GlogWriter struct{}

GlogWriter serves as a bridge between the standard log package and the glog package.

func (GlogWriter) Write

func (writer GlogWriter) Write(data []byte) (n int, err error)

Write implements the io.Writer interface.

type LogWithFormat added in v1.8.0

type LogWithFormat struct {
	logr.Logger
}

LogWithFormat is a wrapper for logger that adds Infof method to log messages with the given format and arguments.

Used as a patch to the controller eventBroadcaster for sending non-string objects.

func WithInfof added in v1.8.0

func WithInfof(l logr.Logger) *LogWithFormat

func (*LogWithFormat) Infof added in v1.8.0

func (l *LogWithFormat) Infof(format string, a ...interface{})

Infof logs message with the given format and arguments.

Jump to

Keyboard shortcuts

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