controller-runtime: sigs.k8s.io/controller-runtime/pkg/log/zap Index | Files

package zap

import "sigs.k8s.io/controller-runtime/pkg/log/zap"

Package zap contains helpers for setting up a new logr.Logger instance using the Zap logging framework.

Index

Package Files

kube_helpers.go zap.go

func Logger Uses

func Logger(development bool) logr.Logger

Logger is a Logger implementation. If development is true, a Zap development config will be used (stacktraces on warnings, no sampling), otherwise a Zap production config will be used (stacktraces on errors, sampling).

func LoggerTo Uses

func LoggerTo(destWriter io.Writer, development bool) logr.Logger

LoggerTo returns a new Logger implementation using Zap which logs to the given destination, instead of stderr. It otherwise behaves like ZapLogger.

func RawLoggerTo Uses

func RawLoggerTo(destWriter io.Writer, development bool, opts ...zap.Option) *zap.Logger

RawLoggerTo returns a new zap.Logger configured with KubeAwareEncoder which logs to a given destination

type KubeAwareEncoder Uses

type KubeAwareEncoder struct {
    // Encoder is the zapcore.Encoder that this encoder delegates to
    zapcore.Encoder

    // Verbose controls whether or not the full object is printed.
    // If false, only name, namespace, api version, and kind are printed.
    // Otherwise, the full object is logged.
    Verbose bool
}

KubeAwareEncoder is a Kubernetes-aware Zap Encoder. Instead of trying to force Kubernetes objects to implement ObjectMarshaller, we just implement a wrapper around a normal ObjectMarshaller that checks for Kubernetes objects.

func (*KubeAwareEncoder) Clone Uses

func (k *KubeAwareEncoder) Clone() zapcore.Encoder

Clone implements zapcore.Encoder

func (*KubeAwareEncoder) EncodeEntry Uses

func (k *KubeAwareEncoder) EncodeEntry(entry zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)

EncodeEntry implements zapcore.Encoder

Package zap imports 12 packages (graph) and is imported by 7 packages. Updated 2019-05-28. Refresh now. Tools for package owners.