Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorKeys = []string{"error", "err"}
View Source
var LogLevels = map[slog.Level]zapcore.Level{ slog.LevelDebug: zap.DebugLevel, slog.LevelInfo: zap.InfoLevel, slog.LevelWarn: zap.WarnLevel, slog.LevelError: zap.ErrorLevel, }
View Source
var SourceKey = "source"
Functions ¶
Types ¶
type Option ¶
type Option struct { // log level (default: debug) Level slog.Leveler // optional: zap logger (default: zap.L()) Logger *zap.Logger // optional: fetch attributes from context AttrFromContext []func(ctx context.Context) []slog.Attr // optional: customize json payload builder Converter Converter // optional: see slog.HandlerOptions AddSource bool ReplaceAttr func(groups []string, a slog.Attr) slog.Attr }
func (Option) NewZapHandler ¶
type ZapHandler ¶
type ZapHandler struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.