logs

package
v0.0.0-...-661d317 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// following analog to https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md
	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 = klogr.New().WithName("csi-driver-cacerts")
)

Functions

func FlushLogs

func FlushLogs()

FlushLogs flushes logs immediately.

func FromContext

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

func InitLogs

func InitLogs(fs *flag.FlagSet)

InitLogs initializes logs the way we want for kubernetes.

func NewContext

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

func V

func V(level int) klog.Verbose

func WithRelatedResource

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

func WithRelatedResourceName

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

func WithResource

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

type LogWithFormat struct {
	logr.Logger
}

func WithInfof

func WithInfof(l logr.Logger) *LogWithFormat

func (*LogWithFormat) Infof

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

is a patch to the controller eventBroadcaster for sending non-string objects

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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