Documentation ¶
Index ¶
- func AddLeveler(l logr.Logger, control levelSetter) (logr.Logger, error)
- func AddSentry(l logr.Logger, opts sentry.ClientOptions, tags map[string]string) (logr.Logger, func() error, error)
- func AddSink(l logr.Logger, sink logConfig) (logr.Logger, func() error, error)
- func New(service string, configs ...logConfig) (logr.Logger, func() error)
- func NewLevelCore(core zapcore.Core, level zapcore.LevelEnabler) zapcore.Core
- func SetLevel(level int8)
- func SetLevelFor(name string, level int8)
- func SetLevelForControl(control levelSetter, level int8)
- func WithConsoleSink(sink io.Writer, opts ...func(*sinkConfig)) logConfig
- func WithCore(core zapcore.Core) logConfig
- func WithJSONSink(sink io.Writer, opts ...func(*sinkConfig)) logConfig
- func WithLevel(level int8) func(*sinkConfig)
- func WithLeveler(leveler levelSetter) func(*sinkConfig)
- func WithNamedLevel(logger logr.Logger, name string) logr.Logger
- func WithSentry(opts sentry.ClientOptions, tags map[string]string) logConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddLeveler ¶ added in v3.10.0
AddLeveler adds a log level control to a logr.Logger.
func AddSentry ¶
func AddSentry(l logr.Logger, opts sentry.ClientOptions, tags map[string]string) (logr.Logger, func() error, error)
AddSentry initializes a sentry client and extends an existing logr.Logger with the hook.
func AddSink ¶
AddSink extends an existing logr.Logger with a new sink. It returns the new logr.Logger, a cleanup function, and an error.
func New ¶
New creates a new log object with the provided configurations. If no sinks are provided, a no-op sink will be used. Returns the logger and a cleanup function that should be executed before the program exits.
func NewLevelCore ¶ added in v3.10.0
NewLevelCore creates a core that can be used to independently control the level of an existing Core. This is essentially a filter that will only log if both the parent and the wrapper cores are enabled.
func SetLevel ¶
func SetLevel(level int8)
SetLevel sets the log level for loggers created with the default level controller.
func SetLevelFor ¶ added in v3.10.0
SetLevelFor sets the log level for a given named control.
func SetLevelForControl ¶ added in v3.10.0
func SetLevelForControl(control levelSetter, level int8)
SetLevelForControl sets the log level for a given control.
func WithConsoleSink ¶
WithConsoleSink adds a console-style output to the logger.
func WithJSONSink ¶
WithJSONSink adds a JSON encoded output to the logger.
func WithLevel ¶ added in v3.10.0
func WithLevel(level int8) func(*sinkConfig)
WithLevel sets the sink's level to a static level. This option prevents changing the log level for this sink later on.
func WithLeveler ¶ added in v3.10.0
func WithLeveler(leveler levelSetter) func(*sinkConfig)
WithLeveler sets the sink's level enabler to leveler.
func WithNamedLevel ¶ added in v3.10.0
WithNamedLevel creates a child logger with a new name and independent log level control (see SetLevelFor). NOTE: if name already exists, the existing controller will be used, otherwise a new controller is created with level matching the parent's log level.
func WithSentry ¶
WithSentry adds sentry integration to the logger. This configuration may fail, in which case, sentry will not be added and execution will continue normally.
Types ¶
This section is empty.