Documentation
¶
Overview ¶
Package log provides support for logging to stdout and stderr.
Log entries will be logged in the following format:
timestamp hostname tag[pid]: SEVERITY Message
Index ¶
- func Debug(format string, v ...interface{})
- func DebugContext(ctx context.Context, msg string, args ...any)
- func Error(format string, v ...interface{})
- func ErrorContext(ctx context.Context, msg string, args ...any)
- func Fatal(format string, v ...interface{})
- func Info(format string, v ...interface{})
- func InfoContext(ctx context.Context, msg string, args ...any)
- func Logger() *slog.Logger
- func SetFormat(format string)
- func SetLevel(level string)
- func SetTag(t string)
- func WarnContext(ctx context.Context, msg string, args ...any)
- func Warning(format string, v ...interface{})
- func With(args ...any) *slog.Logger
- func WithGroup(name string) *slog.Logger
- type ConfdHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugContext ¶
DebugContext logs a message with severity DEBUG and context.
func ErrorContext ¶
ErrorContext logs a message with severity ERROR and context.
func Fatal ¶
func Fatal(format string, v ...interface{})
Fatal logs a message with severity ERROR followed by a call to os.Exit().
func InfoContext ¶
InfoContext logs a message with severity INFO and context.
func SetFormat ¶ added in v0.32.0
func SetFormat(format string)
SetFormat sets the log format. Valid formats are "text" and "json".
func SetLevel ¶
func SetLevel(level string)
SetLevel sets the log level. Valid levels are panic, fatal, error, warn, info and debug.
func WarnContext ¶
WarnContext logs a message with severity WARN and context.
func Warning ¶
func Warning(format string, v ...interface{})
Warning logs a message with severity WARNING.
Types ¶
type ConfdHandler ¶
type ConfdHandler struct {
// contains filtered or unexported fields
}
ConfdHandler is a custom slog.Handler that formats logs in confd's traditional format