Documentation ¶
Index ¶
- Constants
- Variables
- func AsStdHandler(h Handler) stdslog.Handler
- func Debug(msg string, args ...any)
- func DebugCtx(ctx context.Context, msg string, args ...any)
- func Error(msg string, args ...any)
- func ErrorCtx(ctx context.Context, msg string, args ...any)
- func Fatal(obj any, args ...any)
- func Fatalf(format string, v ...any)
- func Fatalln(v ...any)
- func IfError(err error, args ...any)
- func IfFatal(err error, args ...any)
- func IfPanic(err error, args ...any)
- func Info(msg string, args ...any)
- func InfoCtx(ctx context.Context, msg string, args ...any)
- func InstallOldWriter(o *old.Logger, l Logger, level Level)
- func Log(ctx context.Context, level Level, msg string, args ...any)
- func LogAttrs(ctx context.Context, level Level, msg string, attrs ...Attr)
- func OrError(fn func() error, args ...any)
- func OrFatal(fn func() error, args ...any)
- func OrPanic(fn func() error, args ...any)
- func Panic(obj any, args ...any)
- func Panicf(format string, v ...any)
- func Panicln(v ...any)
- func Print(v ...any)
- func Printf(format string, v ...any)
- func Println(v ...any)
- func RecordFrame(r Record) runtime.Frame
- func Warn(msg string, args ...any)
- func WarnCtx(ctx context.Context, msg string, args ...any)
- type Action
- type Attr
- func Any(key string, value any) Attr
- func ArgsToAttr(args []any) (Attr, []any)
- func Bool(key string, v bool) Attr
- func Duration(key string, v time.Duration) Attr
- func E(e error) Attr
- func Float64(key string, v float64) Attr
- func Group(key string, as ...Attr) Attr
- func Int(key string, value int) Attr
- func Int64(key string, value int64) Attr
- func P(v any) Attr
- func String(key, value string) Attr
- func Time(key string, v time.Time) Attr
- func Uint64(key string, v uint64) Attr
- type Formatter
- type FormatterHandler
- type Handler
- type Kind
- type Level
- type LevelVar
- type Leveler
- type LogPanic
- type Logger
- func (l Logger) Context() context.Context
- func (l Logger) Debug(msg string, args ...any)
- func (l Logger) DefaultContext() context.Context
- func (l Logger) DefaultHandler() Handler
- func (l Logger) Enabled(level Level) bool
- func (l Logger) Error(msg string, args ...any)
- func (l Logger) Fatal(obj any, args ...any)
- func (l Logger) Handler() Handler
- func (l Logger) IfError(err error, args ...any)
- func (l Logger) IfFatal(err error, args ...any)
- func (l Logger) IfPanic(err error, args ...any)
- func (l Logger) Info(msg string, args ...any)
- func (l Logger) Log(level Level, msg string, args ...any)
- func (l Logger) LogAttrs(level Level, msg string, attrs ...Attr)
- func (l Logger) OrError(fn func() error, args ...any)
- func (l Logger) OrFatal(fn func() error, args ...any)
- func (l Logger) OrPanic(fn func() error, args ...any)
- func (l Logger) Panic(obj any, args ...any)
- func (l Logger) Warn(msg string, args ...any)
- func (l Logger) With(args ...any) Logger
- func (l Logger) WithContext(ctx context.Context) Logger
- func (l Logger) WithGroup(name string) Logger
- type MultiHandler
- type NullHandler
- type Record
- type Value
- type Writer
Constants ¶
View Source
const ( TimeKey = slog.TimeKey LevelKey = slog.LevelKey MessageKey = slog.MessageKey SourceKey = slog.SourceKey )
View Source
const ( LevelDebug = slog.LevelDebug LevelInfo = slog.LevelInfo LevelWarn = slog.LevelWarn LevelError = slog.LevelError )
View Source
const ( KindAny = slog.KindAny KindBool = slog.KindBool KindDuration = slog.KindDuration KindFloat64 = slog.KindFloat64 KindInt64 = slog.KindInt64 KindString = slog.KindString KindTime = slog.KindTime KindUint64 = slog.KindUint64 KindGroup = slog.KindGroup KindLogValuer = slog.KindLogValuer )
View Source
const BadKey = "!BADKEY"
View Source
const ErrorKey = "error"
View Source
const ErrorMsg = "error"
View Source
const PanicKey = "panic"
Variables ¶
View Source
var IgnorePC = false
Functions ¶
func AsStdHandler ¶
func RecordFrame ¶
Types ¶
type Attr ¶
func ArgsToAttr ¶
type FormatterHandler ¶
type FormatterHandler struct {
// contains filtered or unexported fields
}
func NewFormatterHandler ¶
func NewFormatterHandler( f Formatter, w Writer, lv Level, ) FormatterHandler
func (*FormatterHandler) Enabled ¶
func (h *FormatterHandler) Enabled(ctx context.Context, level Level) bool
func (*FormatterHandler) Handle ¶
func (h *FormatterHandler) Handle(ctx context.Context, record Record) error
func (*FormatterHandler) WithAttrs ¶
func (h *FormatterHandler) WithAttrs(attrs []Attr) Handler
func (*FormatterHandler) WithGroup ¶
func (h *FormatterHandler) WithGroup(name string) Handler
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func DefaultCtx ¶
func (Logger) DefaultContext ¶
func (Logger) DefaultHandler ¶
type MultiHandler ¶
type MultiHandler struct {
// contains filtered or unexported fields
}
func NewMultiHandler ¶
func NewMultiHandler(hs ...Handler) MultiHandler
func (MultiHandler) WithAttrs ¶
func (h MultiHandler) WithAttrs(attrs []Attr) Handler
func (MultiHandler) WithGroup ¶
func (h MultiHandler) WithGroup(name string) Handler
type NullHandler ¶
type NullHandler struct{}
func (NullHandler) WithAttrs ¶
func (h NullHandler) WithAttrs(attrs []Attr) Handler
func (NullHandler) WithGroup ¶
func (h NullHandler) WithGroup(name string) Handler
Source Files ¶
Click to show internal directories.
Click to hide internal directories.