Versions in this module Expand all Collapse all v0 v0.2.0 Jul 6, 2024 v0.1.0 Jun 27, 2024 Changes in this version + const CtxKeyLogAttrs + const CtxKeyXRequestId + const ErrCodeIncorrectOperation + const ErrCodeInsufficientPrivileges + const ErrCodeInvalidArgument + const ErrCodeNotExists + const ErrCodeSystem + const ErrCodeTimeout + const ErrCodeUnavailable + const ErrCodeUnknown + const ErrCodeValidation + const LogKeyComponent + const LogKeyError + const LogKeyErrorReason + const LogKeyRequestId + var ErrIncorrectOperation = Error + var ErrInsufficientPrivileges = Error + var ErrInvalidArgument = Error + var ErrNotExists = Error + var ErrSystem = Error + var ErrTimeout = Error + var ErrUnavailable = Error + var ErrUnknown = Error + var ErrValidation = Error + func RequestID(ctx context.Context) string + func WithAddSource(addSource bool) func(logger *Logger) + func WithLogAttrs(ctx context.Context, attrs Attrs) context.Context + func WithLogLevel(level slog.Level) func(*Logger) + func WithRequestID(ctx context.Context, reqID string) context.Context + type Attrs map[string]any + func LogAttrs(ctx context.Context) Attrs + type Error struct + func Err(code, msg string, reason ...error) Error + func (e Error) Code() string + func (e Error) Error() string + func (e Error) Is(target error) bool + func (e Error) Message() string + func (e Error) Unwrap() error + type LogHandlerMiddleware struct + func NewLogHandlerMiddleware(next slog.Handler) *LogHandlerMiddleware + func (l LogHandlerMiddleware) Enabled(ctx context.Context, level slog.Level) bool + func (l LogHandlerMiddleware) Handle(ctx context.Context, record slog.Record) error + func (l LogHandlerMiddleware) WithAttrs(attrs []slog.Attr) slog.Handler + func (l LogHandlerMiddleware) WithGroup(name string) slog.Handler + type Logger struct + func NewLogger(w io.Writer, options ...LoggerOption) *Logger + func (l *Logger) Err(err error, msg string, args ...any) + func (l *Logger) ErrContext(ctx context.Context, err error, msg string, args ...any) + func (l *Logger) LogLogger() *log.Logger + func (l *Logger) SetLevel(level slog.Level) + func (l *Logger) With(args ...any) *Logger + func (l *Logger) WithComponent(component string) *Logger + func (l *Logger) WithGroup(name string) *Logger + type LoggerOption func(*Logger) + type NoopLogger struct + func (n NoopLogger) Enabled(_ context.Context, _ slog.Level) bool + func (n NoopLogger) Handle(_ context.Context, _ slog.Record) error + func (n NoopLogger) WithAttrs(_ []slog.Attr) slog.Handler + func (n NoopLogger) WithGroup(_ string) slog.Handler