Documentation ¶
Index ¶
- func LeadingSpaces(s string) (n int)
- func OneOf[T comparable](val T, options ...T) bool
- func Panicf(msg string, args ...any)
- func RightShift[S []E, E any](s S, e ...E) S
- func TrailingSpaces(s string) (n int)
- func UpperFirst(s string) (_ string)
- type SLogBufferHandler
- func (h *SLogBufferHandler) Content() string
- func (h *SLogBufferHandler) Enabled(ctx context.Context, level slog.Level) bool
- func (h *SLogBufferHandler) Handle(ctx context.Context, record slog.Record) error
- func (h *SLogBufferHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *SLogBufferHandler) WithGroup(name string) slog.Handler
- type Stack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LeadingSpaces ¶
LeadingSpaces returns the number of leading spaces in a string, e.g.
LeadingSpaces("foo") => 0 LeadingSpaces(" foo") => 1 LeadingSpaces(" foo") => 2 LeadingSpaces(" foo") => 3
func OneOf ¶
func OneOf[T comparable](val T, options ...T) bool
func RightShift ¶
func RightShift[S []E, E any](s S, e ...E) S
func TrailingSpaces ¶
TrailingSpaces returns the number of trailing spaces in a string, e.g.
TrailingSpaces("bar") => 0 TrailingSpaces("bar ") => 1 TrailingSpaces("bar ") => 2 TrailingSpaces("bar ") => 3
func UpperFirst ¶
Types ¶
type SLogBufferHandler ¶
type SLogBufferHandler struct { FormatFunc func(record slog.Record) string // contains filtered or unexported fields }
SLogBufferHandler is a custom log handler that writes logs to a bytes.Buffer.
func NewSLogBufferHandler ¶
func NewSLogBufferHandler() *SLogBufferHandler
NewSLogBufferHandler creates a new SLogBufferHandler.
func (*SLogBufferHandler) Content ¶
func (h *SLogBufferHandler) Content() string
Content returns the content of the log buffer.
type Stack ¶
type Stack[T comparable] struct { // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.