logging

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigName = "config-logging"
)

Variables

This section is empty.

Functions

func FromContext

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

FromContext returns the logger stored in context. Returns nil if no logger is set in context, or if the stored value is not of correct type.

func NewLogger

func NewLogger(configJSON string, levelOverride string) (*zap.SugaredLogger, zap.AtomicLevel)

NewLogger creates a logger with the supplied configuration. In addition to the logger, it returns AtomicLevel that can be used to change the logging level at runtime. If configuration is empty, a fallback configuration is used. If configuration cannot be used to instantiate a logger, the same fallback configuration is used.

func NewLoggerFromConfig

func NewLoggerFromConfig(config *Config, name string) (*zap.SugaredLogger, zap.AtomicLevel)

NewLoggerFromConfig creates a logger using the provided Config

func WithLogger

func WithLogger(ctx context.Context, logger *zap.SugaredLogger) context.Context

WithLogger returns a copy of parent context in which the value associated with logger key is the supplied logger.

Types

type Config

type Config struct {
	LoggingConfig string
	LoggingLevel  map[string]zapcore.Level
}

Config contains the configuration defined in the logging ConfigMap.

func NewConfigFromConfigMap

func NewConfigFromConfigMap(configMap *corev1.ConfigMap) (*Config, error)

NewConfigFromConfigMap creates a LoggingConfig from the supplied ConfigMap

func NewConfigFromMap

func NewConfigFromMap(data map[string]string) (*Config, error)

NewConfigFromMap creates a LoggingConfig from the supplied map

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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