Documentation
¶
Index ¶
- Constants
- type Handler
- func (h *Handler) Enabled(ctx context.Context, l slog.Level) bool
- func (h *Handler) ExtendPrefix(s string) *Handler
- func (h *Handler) Handle(ctx context.Context, r slog.Record) error
- func (h *Handler) IgnoreAttrs(keys ...string) *Handler
- func (h *Handler) WithAttrs(as []slog.Attr) slog.Handler
- func (h *Handler) WithGroup(name string) slog.Handler
- type HandlerOptions
Constants ¶
View Source
const ( DefaultDelimiter = " " ColonDelimiter = ": " )
View Source
const ( LevelDebug = slog.LevelDebug LevelInfo = slog.LevelInfo LevelNotice = slog.LevelInfo + 2 LevelWarn = slog.LevelWarn LevelError = slog.LevelError LevelCrit = slog.LevelError + 4 LevelAlert = slog.LevelError + 8 )
View Source
const LargeMessageSupport = true
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(opts *HandlerOptions) (*Handler, error)
func (*Handler) ExtendPrefix ¶
func (*Handler) IgnoreAttrs ¶
type HandlerOptions ¶
type HandlerOptions struct { // Level reports the minimum record level that will be logged. // The handler discards records with lower levels. // If Level is nil, the handler assumes LevelDebug. // The handler calls Level.Level for each record processed; // to adjust the minimum level dynamically, use a LevelVar. Level slog.Leveler // Delimiter is inserted between message and attributes (if there are // attributes). It defaults to a space. Delimiter string // Prefix is prepended to message strings. Prefix string IgnoreAttrs []string // TimeFormat for attribute values. Default is to use [time.Time.String] // method. TimeFormat string Socket string }
Click to show internal directories.
Click to hide internal directories.