Versions in this module Expand all Collapse all v1 v1.0.0 Jul 15, 2026 Changes in this version + const LevelFatal + const LevelTrace + var KeyRequestID = ContextKey("request_id") + var KeyTenantID = ContextKey("tenant_id") + var KeyUserID = ContextKey("user_id") + func Dump(key string, v any, opts ...DumpOption) slog.Attr + func DumpGroup(key string, v any, opts ...DumpOption) slog.Attr + func DumpGroupWith(l *Logger, key string, v any, opts ...DumpOption) slog.Attr + func DumpWith(l *Logger, key string, v any, opts ...DumpOption) slog.Attr + func Err(err error) slog.Attr + func GRPCCall(name, method string, req any, md Metadata, opts ...DumpOption) slog.Attr + func GRPCCallWith(l *Logger, name, method string, req any, md Metadata, opts ...DumpOption) slog.Attr + func GRPCResponse(name string, resp any, opts ...DumpOption) slog.Attr + func GRPCResponseWith(l *Logger, name string, resp any, opts ...DumpOption) slog.Attr + func GRPCStreamEvent(name, method, event string, msg any, md Metadata, opts ...DumpOption) slog.Attr + func GRPCStreamEventWith(l *Logger, name, method, event string, msg any, md Metadata, ...) slog.Attr + func HTTPRequest(name string, r *http.Request, opts ...DumpOption) slog.Attr + func HTTPRequestWith(l *Logger, name string, r *http.Request, opts ...DumpOption) slog.Attr + func HTTPResponse(name string, r *http.Response, opts ...DumpOption) slog.Attr + func HTTPResponseWith(l *Logger, name string, r *http.Response, opts ...DumpOption) slog.Attr + func RestoreBody(r *http.Request, body string) + func Serialize(cfg Config, v any, opts ...DumpOption) any + func SerializeDefault(v any, opts ...DumpOption) any + func SetGlobalDumpConfig(cfg *Config) + func ToContext(ctx context.Context, l *Logger) context.Context + func Value(ctx context.Context, key ContextKey) any + func WithValue(ctx context.Context, key ContextKey, val any) context.Context + type Config struct + AddSource bool + ContextKeys []ContextKey + DumpMaxDepth int + DumpMaxFields int + Format Format + Level slog.Level + LevelNames LevelNames + MaskKeys MaskMap + Masker Masker + Output io.Writer + RemoveKeys RemoveMap + SpanIDKey string + StackDepth int + StackOnError bool + TraceContext bool + TraceIDKey string + TraceSampleKey string + func (c *Config) Clone() *Config + type ContextKey string + func (k ContextKey) String() string + type DefaultMasker struct + func (m *DefaultMasker) Mask(value any, mType MaskType) any + type DumpOption func(*dumpOptions) + func WithDumpDepth(depth int) DumpOption + func WithDumpMaskKeys(keys MaskMap) DumpOption + func WithDumpMaxFields(n int) DumpOption + func WithDumpRemoval(keys ...string) DumpOption + type DynamicHandler struct + func (h *DynamicHandler) Enabled(_ context.Context, level slog.Level) bool + func (h *DynamicHandler) Handle(ctx context.Context, r slog.Record) error + func (h *DynamicHandler) WithAttrs(attrs []slog.Attr) slog.Handler + func (h *DynamicHandler) WithGroup(name string) slog.Handler + type Format int + const FormatJSON + const FormatText + func ParseFormat(s string) Format + type LevelNames map[slog.Level]string + type Logger struct + func Default() *Logger + func Dev() *Logger + func FromContext(ctx context.Context) *Logger + func MustDefault() *Logger + func New(opts ...Option) *Logger + func NewNop() *Logger + func SetupDefault(opts ...Option) *Logger + func (l *Logger) Config() Config + func (l *Logger) FatalContext(ctx context.Context, msg string, args ...any) + func (l *Logger) SetLevel(lvl slog.Level) + func (l *Logger) TraceContext(ctx context.Context, msg string, args ...any) + func (l *Logger) UpdateConfig(fn func(*Config)) + func (l *Logger) With(args ...any) *Logger + func (l *Logger) WithGroup(name string) *Logger + type MaskMap map[string]MaskType + type MaskRules struct + func NewMaskRules() *MaskRules + func (r *MaskRules) Add(key string, mType MaskType) *MaskRules + func (r *MaskRules) Keys() MaskMap + type MaskType int + const MaskCard + const MaskDefault + const MaskEmail + const MaskPhone + const MaskSecret + type Masker interface + Mask func(value any, mType MaskType) any + type Metadata map[string][]string + type Option func(*options) + func WithAddSource(enabled bool) Option + func WithContextKeys(keys ...ContextKey) Option + func WithDumpLimits(maxDepth, maxFields int) Option + func WithExitFunc(fn func(int)) Option + func WithFormat(f Format) Option + func WithLevel(l slog.Level) Option + func WithLevelNames(m LevelNames) Option + func WithMaskKey(key string, mType MaskType) Option + func WithMaskKeys(keys MaskMap) Option + func WithMaskRules(r *MaskRules) Option + func WithMasker(m Masker) Option + func WithOutput(w io.Writer) Option + func WithRemoval(set *RemovalSet) Option + func WithStackDepth(depth int) Option + func WithStackOnError(enabled bool) Option + func WithTraceContext(enabled bool) Option + func WithTraceKeys(traceID, spanID, traceSampled string) Option + type RemovalSet struct + func NewRemovalSet(keys ...string) *RemovalSet + func (s *RemovalSet) Add(keys ...string) *RemovalSet + func (s *RemovalSet) Keys() []string + type RemoveMap map[string]struct