Documentation ¶
Overview ¶
Package logging provides logging primitives.
Index ¶
- Variables
- func Component(name string) zapcore.Field
- func NewControllerErrorSuppressor(core zapcore.Core, threshold int64) zapcore.Core
- func NewWriter(l *zap.Logger, level zapcore.Level) io.Writer
- func Wrap(writer io.Writer) *zap.Logger
- func ZapLogger(dests ...*LogDestination) *zap.Logger
- type LogDestination
- type LogDestinationOption
- type LogWriter
Constants ¶
This section is empty.
Variables ¶
var StdWriter = &logWrapper{nil}
StdWriter creates a sync writer that writes all logs to the std logger.
Functions ¶
func NewControllerErrorSuppressor ¶ added in v1.8.0
NewControllerErrorSuppressor creates a new controller error suppressor.
It suppresses error logs for a given controller unless it logs >= threshold errors. The idea is that all controllers reconcile errors, so if the error is not transient, it will be reported enough time to hit the threshold, but transient errors will be suppressed.
The suppressor records the controller name by inspecting a log field named "controller" passed via `logger.With()` call.
func ZapLogger ¶
func ZapLogger(dests ...*LogDestination) *zap.Logger
ZapLogger creates new default Zap Logger.
Types ¶
type LogDestination ¶
type LogDestination struct {
// contains filtered or unexported fields
}
LogDestination defines logging destination Config.
func NewLogDestination ¶
func NewLogDestination(writer io.Writer, logLevel zapcore.LevelEnabler, options ...LogDestinationOption) *LogDestination
NewLogDestination creates new log destination.
type LogDestinationOption ¶ added in v1.8.0
type LogDestinationOption func(dest *LogDestination)
LogDestinationOption defines a log destination encoder config setter.
func WithColoredLevels ¶
func WithColoredLevels() LogDestinationOption
WithColoredLevels enables log level colored output.
func WithControllerErrorSuppressor ¶ added in v1.8.0
func WithControllerErrorSuppressor(threshold int64) LogDestinationOption
WithControllerErrorSuppressor creates a new console log controller error suppressor.
func WithoutLogLevels ¶
func WithoutLogLevels() LogDestinationOption
WithoutLogLevels disable log level.
func WithoutTimestamp ¶
func WithoutTimestamp() LogDestinationOption
WithoutTimestamp disables timestamp.