Documentation ¶
Overview ¶
Package log provides logging routines based on slog package.
Index ¶
- Constants
- Variables
- func Debugf(format string, args ...any)
- func Disable()
- func Errorf(format string, args ...any)
- func Fatalf(format string, args ...any)
- func Infof(format string, args ...any)
- func Init(opts ...Option) error
- func New(enabled bool) logr.Logger
- func NewDefaultLogWriter(level LogLevel) io.Writer
- func Warnf(format string, args ...any)
- type LogLevel
- type Option
Constants ¶
View Source
const ( DebugLevel = slog.LevelDebug InfoLevel = slog.LevelInfo WarnLevel = slog.LevelWarn ErrorLevel = slog.LevelError )
Variables ¶
View Source
var DefaultLogger = slog.Default()
DefaultLogger is the default logger.
Functions ¶
func NewDefaultLogWriter ¶
NewDefaultLogWriter returns a io.Writer that logs to the given logger at the given level.
Types ¶
type Option ¶
type Option func(*options)
Option is a logger option.
func WithAlsoLogToStderr ¶
func WithAlsoLogToStderr() Option
WithAlsoLogToStderr also logs to stderr.
func WithDevMode ¶
func WithDevMode() Option
WithDevMode sets the logger to development mode. In development mode, the logger logs in human-readable format, the level is set to DebugLevel, and logs are also written to stderr.
Click to show internal directories.
Click to hide internal directories.