ctxlog

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Source Files

  • context.go
  • events.go
  • logging.go

Jump to

Keyboard shortcuts

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