Documentation ¶
Index ¶
Constants ¶
View Source
const (
// DefaultTimeFormat is the default format for any [time.Time] logged.
DefaultTimeFormat = "2006-01-02T15:04:05,000Z07:00"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is a slog.Handler that writes human-readable logs.
func NewHandler ¶
func NewHandler(options HandlerOptions, w io.Writer) *Handler
NewHandler returns a new Handler with HandlerOptions.
func (*Handler) Enabled ¶
Enabled returns true if a message at a slog.Level would be logged.
func (*Handler) Handle ¶
Handle handles a slog.Record.
type HandlerOptions ¶
type HandlerOptions struct { // Use all of [slog.HandlerOptions]. slog.HandlerOptions // Language for formatting numbers. Language language.Tag // TimeFormat for timestamps and [time.Time] attributes. Defaults to // [DefaultTimeFormat] if unset. TimeFormat string }
HandlerOptions are options for a Handler.
Click to show internal directories.
Click to hide internal directories.