Documentation ¶
Overview ¶
copy from offical
copy from offical
Index ¶
- Constants
- Variables
- func AppendSlogValue(v slog.Value, dst []byte) []byte
- func Close()
- func Debug(msg ...any)
- func Debugf(msg string, args ...any)
- func Default() *logger
- func Emergency(msg ...any)
- func Emergencyf(msg string, args ...any)
- func Err(msg ...any)
- func Errf(msg string, args ...any)
- func Fatalf(format string, v ...any)
- func Fatalln(v ...any)
- func Flush()
- func GetLevel() slog.Level
- func Info(msg ...any)
- func Infof(msg string, args ...any)
- func IsEmpty(a slog.Attr) bool
- func NewCustomHandler(w io.Writer, opts *slog.HandlerOptions) *custom_handler
- func Notice(msg ...any)
- func Noticef(msg string, args ...any)
- func SetCreateHandler(fn create_handler)
- func SetDaily()
- func SetDeltaSkip(v int)
- func SetFolder(f string)
- func SetLevel(v slog.Level)
- func SetWrapFunc(f warp_func)
- func Trace(msg ...any)
- func Tracef(msg string, args ...any)
- func Warn(msg ...any)
- func Warnf(msg string, args ...any)
- type Buffer
- func (b *Buffer) Free()
- func (b *Buffer) Reset()
- func (b *Buffer) String() string
- func (b *Buffer) Write(p []byte) (int, error)
- func (b *Buffer) WriteByte(c byte) error
- func (b *Buffer) WritePosInt(i int)
- func (b *Buffer) WritePosIntWidth(i, width int)
- func (b *Buffer) WriteString(s string) (int, error)
- type Field
- func (this Field) Add(key string, value any) Field
- func (this Field) Debug(msg ...any)
- func (this Field) Debugf(msg string, args ...any)
- func (this Field) Emergency(msg ...any)
- func (this Field) Emergencyf(msg string, args ...any)
- func (this Field) Err(msg ...any)
- func (this Field) Errf(msg string, args ...any)
- func (this Field) Fatal(msg ...any)
- func (this Field) Fatalf(msg string, args ...any)
- func (this Field) Info(msg ...any)
- func (this Field) Infof(msg string, args ...any)
- func (this Field) Notice(msg ...any)
- func (this Field) Noticef(msg string, args ...any)
- func (this Field) Trace(msg ...any)
- func (this Field) Tracef(msg string, args ...any)
- func (this Field) Warn(msg ...any)
- func (this Field) Warnf(msg string, args ...any)
Constants ¶
View Source
const ( LevelTrace = slog.Level(-8) LevelDebug = slog.LevelDebug LevelInfo = slog.LevelInfo LevelNotice = slog.Level(2) LevelWarn = slog.LevelWarn LevelErr = slog.LevelError LevelEmergency = slog.Level(12) LevelFatal = slog.Level(16) )
这里没有位运算
Variables ¶
View Source
var DailyHandlerCreateFunc create_handler = func(w io.Writer, opt *slog.HandlerOptions) slog.Handler { return NewCustomHandler(w, opt) }
View Source
var StdJsonHandlerCreateFunc create_handler = func(_ io.Writer, opt *slog.HandlerOptions) slog.Handler { return slog.NewJSONHandler(os.Stdout, opt) }
View Source
var StdTextHandlerCreateFunc create_handler = func(_ io.Writer, opt *slog.HandlerOptions) slog.Handler { return slog.NewTextHandler(os.Stdout, opt) }
Functions ¶
func Emergencyf ¶
func NewCustomHandler ¶ added in v1.0.2
func NewCustomHandler(w io.Writer, opts *slog.HandlerOptions) *custom_handler
func SetCreateHandler ¶ added in v1.0.2
func SetCreateHandler(fn create_handler)
func SetDeltaSkip ¶ added in v1.0.11
func SetDeltaSkip(v int)
Types ¶
type Buffer ¶ added in v1.0.2
type Buffer []byte
buffer adapted from go/src/fmt/print.go
func (*Buffer) WritePosInt ¶ added in v1.0.2
func (*Buffer) WritePosIntWidth ¶ added in v1.0.2
WritePosIntWidth writes non-negative integer i to the buffer, padded on the left by zeroes to the given width. Use a width of 0 to omit padding.
Click to show internal directories.
Click to hide internal directories.