Documentation
¶
Index ¶
- Constants
- func Crit(msg string, ctx ...interface{})
- func Debug(msg string, ctx ...interface{})
- func DiscardHandler() slog.Handler
- func Error(msg string, ctx ...interface{})
- func FormatLogfmtUint64(n uint64) string
- func FormatSlogValue(v slog.Value, tmp []byte) (result []byte)
- func FromLegacyLevel(lvl int) slog.Level
- func Info(msg string, ctx ...interface{})
- func JSONHandler(wr io.Writer) slog.Handler
- func JSONHandlerWithLevel(wr io.Writer, level slog.Level) slog.Handler
- func LevelAlignedString(l slog.Level) string
- func LevelString(l slog.Level) string
- func LogfmtHandler(wr io.Writer) slog.Handler
- func LogfmtHandlerWithLevel(wr io.Writer, level slog.Level) slog.Handler
- func SetDefault(l Logger)
- func StirngLevel(lvl string) slog.Level
- func Trace(msg string, ctx ...interface{})
- func Warn(msg string, ctx ...interface{})
- type GlogHandler
- func (h *GlogHandler) Enabled(_ context.Context, lvl slog.Level) bool
- func (h *GlogHandler) Handle(_ context.Context, r slog.Record) error
- func (h *GlogHandler) Verbosity(level slog.Level)
- func (h *GlogHandler) Vmodule(ruleset string) error
- func (h *GlogHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *GlogHandler) WithGroup(name string) slog.Handler
- type Logger
- type TerminalHandler
- func (h *TerminalHandler) Enabled(_ context.Context, level slog.Level) bool
- func (h *TerminalHandler) Handle(_ context.Context, r slog.Record) error
- func (h *TerminalHandler) ResetFieldPadding()
- func (h *TerminalHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *TerminalHandler) WithGroup(name string) slog.Handler
- type TerminalStringer
Constants ¶
View Source
const ( LevelTrace slog.Level = -8 LevelDebug = slog.LevelDebug LevelInfo = slog.LevelInfo LevelWarn = slog.LevelWarn LevelError = slog.LevelError LevelCrit slog.Level = 12 LvlTrace = LevelTrace LvlInfo = LevelInfo LvlDebug = LevelDebug )
Variables ¶
This section is empty.
Functions ¶
func DiscardHandler ¶
func FormatLogfmtUint64 ¶
func FromLegacyLevel ¶
func LevelAlignedString ¶
func LevelString ¶
func LogfmtHandlerWithLevel ¶
func SetDefault ¶
func SetDefault(l Logger)
func StirngLevel ¶
Types ¶
type GlogHandler ¶
type GlogHandler struct {
// contains filtered or unexported fields
}
func NewGlogHandler ¶
func NewGlogHandler(h slog.Handler) *GlogHandler
func (*GlogHandler) Verbosity ¶
func (h *GlogHandler) Verbosity(level slog.Level)
func (*GlogHandler) Vmodule ¶
func (h *GlogHandler) Vmodule(ruleset string) error
type Logger ¶
type Logger interface {
With(ctx ...interface{}) Logger
New(ctx ...interface{}) Logger
Log(level slog.Level, msg string, ctx ...interface{})
Trace(msg string, ctx ...interface{})
Debug(msg string, ctx ...interface{})
Info(msg string, ctx ...interface{})
Warn(msg string, ctx ...interface{})
Error(msg string, ctx ...interface{})
Crit(msg string, ctx ...interface{})
Write(level slog.Level, msg string, attrs ...any)
Enabled(ctx context.Context, level slog.Level) bool
Handler() slog.Handler
}
type TerminalHandler ¶
type TerminalHandler struct {
// contains filtered or unexported fields
}
func NewTerminalHandler ¶
func NewTerminalHandler(wr io.Writer, useColor bool) *TerminalHandler
func (*TerminalHandler) ResetFieldPadding ¶
func (h *TerminalHandler) ResetFieldPadding()
type TerminalStringer ¶
type TerminalStringer interface {
TerminalString() string
}
Click to show internal directories.
Click to hide internal directories.