log

package
v3.88.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

func AddSink(l logr.Logger, sink logConfig) (logr.Logger, func() error, error)

AddSink extends an existing logr.Logger with a new sink. It returns the new logr.Logger, a cleanup function, and an error.

func New

func New(service string, configs ...logConfig) (logr.Logger, func() error)

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 NewRedactionCore added in v3.83.0

func NewRedactionCore(core zapcore.Core, redactor *dynamicRedactor) zapcore.Core

NewRedactionCore creates a zapcore.Core that performs redaction of logs in the message and field values.

func RedactGlobally added in v3.83.0

func RedactGlobally(sensitiveValue string)

RedactGlobally configures the global log redactor to redact the provided value during log emission. The value will be redacted in log messages and values that are strings, but not in log keys or values of other types.

func SetLevel

func SetLevel(level int8)

SetLevel sets the log level for loggers created with the default level controller.

func SetLevelForControl added in v3.10.0

func SetLevelForControl(control levelSetter, level int8)

SetLevelForControl sets the log level for a given control.

func ToLogger added in v3.84.0

func ToLogger(l logr.Logger) *log.Logger

ToLogger converts the logr.Logger into a legacy *log.Logger.

func ToSlogger added in v3.84.0

func ToSlogger(l logr.Logger) *slog.Logger

ToSlogger converts the logr.Logger into a *slog.Logger.

func WithConsoleSink

func WithConsoleSink(sink io.Writer, opts ...func(*sinkConfig)) logConfig

WithConsoleSink adds a console-style output to the logger.

func WithCore

func WithCore(core zapcore.Core) logConfig

WithCore adds any user supplied zap core to the logger.

func WithGlobalRedaction added in v3.83.0

func WithGlobalRedaction() func(*sinkConfig)

WithGlobalRedaction adds values to be redacted from logs.

func WithJSONSink

func WithJSONSink(sink io.Writer, opts ...func(*sinkConfig)) logConfig

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 WithSentry

func WithSentry(opts sentry.ClientOptions, tags map[string]string) logConfig

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.

Jump to

Keyboard shortcuts

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