Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GORMLogger ¶
func GORMLogger(l Logger) gormlogger.Interface
GORMLogger adapts a chok Logger to gorm/logger.Interface.
Types ¶
type Logger ¶
type Logger interface {
Debug(msg string, keysAndValues ...any)
Info(msg string, keysAndValues ...any)
Warn(msg string, keysAndValues ...any)
Error(msg string, keysAndValues ...any)
DebugContext(ctx context.Context, msg string, keysAndValues ...any)
InfoContext(ctx context.Context, msg string, keysAndValues ...any)
WarnContext(ctx context.Context, msg string, keysAndValues ...any)
ErrorContext(ctx context.Context, msg string, keysAndValues ...any)
With(keysAndValues ...any) Logger
// SetLevel dynamically changes the minimum log level. Accepts
// "debug" / "info" / "warn" / "warning" / "error". Returns an error
// for unsupported values. Loggers that don't support dynamic levels
// (e.g. Empty) may treat this as a no-op.
SetLevel(level string) error
}
Logger is the framework's logging interface.
func FromContext ¶
FromContext retrieves the Logger stored in ctx by WithContext. Returns nil if no logger is present — callers should fall back to a default logger when nil is returned.
func NewDefaultSlog ¶
func NewDefaultSlog() Logger
NewDefaultSlog creates a JSON/info Logger writing to stdout.
func NewSlog ¶
func NewSlog(opts *config.SlogOptions) Logger
NewSlog creates a Logger from SlogOptions.
Click to show internal directories.
Click to hide internal directories.