ctxlog

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package ctxlog extends ctxlog with events

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(ctx context.Context, v ...interface{})

Debug uses the stored zap logger

func Debugf

func Debugf(ctx context.Context, format string, v ...interface{})

Debugf uses the stored zap logger

func Error

func Error(ctx context.Context, v ...interface{})

Error uses the stored zap logger

func Errorf

func Errorf(ctx context.Context, format string, v ...interface{})

Errorf uses the stored zap logger

func ExtractLogger

func ExtractLogger(ctx context.Context) *zap.SugaredLogger

ExtractLogger returns the logger from the context

func ExtractRecorder added in v0.2.0

func ExtractRecorder(ctx context.Context) record.EventRecorder

ExtractRecorder returns the event recorder from the context

func Info

func Info(ctx context.Context, v ...interface{})

Info uses the stored zap logger

func Infof

func Infof(ctx context.Context, format string, v ...interface{})

Infof uses the stored zap logger

func NewContextWithRecorder added in v0.2.0

func NewContextWithRecorder(ctx context.Context, name string, recorder record.EventRecorder) context.Context

NewContextWithRecorder returns a new child context with the named recorder and log inside

func NewParentContext added in v0.2.0

func NewParentContext(log *zap.SugaredLogger) context.Context

NewParentContext returns a new context with a logger

func WarningEvent added in v0.2.0

func WarningEvent(ctx context.Context, object runtime.Object, reason, msg string)

WarningEvent will create a warning event, without logging

Types

type EventLogger added in v0.2.0

type EventLogger interface {
	Infof(context.Context, string, ...interface{})
	Errorf(context.Context, string, ...interface{}) error
	Error(context.Context, ...interface{}) error
}

EventLogger adds events and writes logs

func WithEvent added in v0.2.0

func WithEvent(object runtime.Object, reason string) EventLogger

WithEvent returns a struct to provide event enhanced logging methods

Jump to

Keyboard shortcuts

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