Documentation ¶
Index ¶
- Constants
- Variables
- func Any(key string, value any) slog.Attr
- func Bool(key string, v bool) slog.Attr
- func Close()
- func Debug(msg string, args ...any)
- func Dump(dump string, args ...any)
- func Duration(key string, v time.Duration) slog.Attr
- func Error(msg string, args ...any)
- func ErrorAttr(key string, value error) slog.Attr
- func Fatal(msg string, args ...any)
- func Float64(key string, v float64) slog.Attr
- func Group(key string, args ...any) slog.Attr
- func Info(msg string, args ...any)
- func Int(key string, value int) slog.Attr
- func Int16(key string, value int16) slog.Attr
- func Int32(key string, value int32) slog.Attr
- func Int64(key string, value int64) slog.Attr
- func Int8(key string, value int8) slog.Attr
- func NewOriginJsonHandler(level slog.Level, w io.Writer, addSource bool, ...) slog.Handler
- func NewOriginTextHandler(level slog.Level, w io.Writer, addSource bool, ...) slog.Handler
- func SDebug(a ...interface{})
- func SError(a ...interface{})
- func SInfo(a ...interface{})
- func STrace(a ...interface{})
- func SWarning(a ...interface{})
- func SetLogger(logger ILogger)
- func Stack(msg string, args ...any)
- func String(key, value string) slog.Attr
- func Time(key string, v time.Time) slog.Attr
- func Trace(msg string, args ...any)
- func Uint(key string, value uint) slog.Attr
- func Uint16(key string, value uint16) slog.Attr
- func Uint32(key string, value uint32) slog.Attr
- func Uint64(key string, v uint64) slog.Attr
- func Uint8(key string, value uint8) slog.Attr
- func Warning(msg string, args ...any)
- type BaseHandler
- type Buffer
- func (b *Buffer) AppendBool(v bool)
- func (b *Buffer) AppendByte(v byte)
- func (b *Buffer) AppendBytes(v []byte)
- func (b *Buffer) AppendFloat(f float64, bitSize int)
- func (b *Buffer) AppendInt(i int64)
- func (b *Buffer) AppendString(s string)
- func (b *Buffer) AppendUint(i uint64)
- func (b *Buffer) Bytes() []byte
- func (b *Buffer) Cap() int
- func (buff *Buffer) Init()
- func (b *Buffer) Len() int
- func (b *Buffer) Reset()
- func (b *Buffer) String() string
- func (b *Buffer) TrimNewline()
- func (b *Buffer) Write(bs []byte) (int, error)
- type ILogger
- type IOriginHandler
- type IoWriter
- type Logger
- func (logger *Logger) Close()
- func (logger *Logger) Debug(msg string, args ...any)
- func (logger *Logger) DoSPrintf(level slog.Level, a []interface{})
- func (logger *Logger) Dump(msg string, args ...any)
- func (logger *Logger) Error(msg string, args ...any)
- func (logger *Logger) Fatal(msg string, args ...any)
- func (logger *Logger) FormatHeader(buf *Buffer, level slog.Level, calldepth int)
- func (logger *Logger) Info(msg string, args ...any)
- func (logger *Logger) SDebug(a ...interface{})
- func (logger *Logger) SError(a ...interface{})
- func (logger *Logger) SInfo(a ...interface{})
- func (logger *Logger) STrace(a ...interface{})
- func (logger *Logger) SWarning(a ...interface{})
- func (logger *Logger) Stack(msg string, args ...any)
- func (logger *Logger) Trace(msg string, args ...any)
- func (logger *Logger) Warning(msg string, args ...any)
- type OriginJsonHandler
- type OriginTextHandler
Constants ¶
View Source
const ( LevelTrace = slog.Level(-8) LevelDebug = slog.LevelDebug LevelInfo = slog.LevelInfo LevelWarning = slog.LevelWarn LevelError = slog.LevelError LevelStack = slog.Level(12) LevelDump = slog.Level(16) LevelFatal = slog.Level(20) )
levels
Variables ¶
View Source
var LogChannelCap int
View Source
var LogLevel slog.Level = LevelTrace
View Source
var LogPath string
View Source
var LogSize int64
View Source
var OpenConsole bool
Functions ¶
func NewOriginJsonHandler ¶
func NewOriginTextHandler ¶
Types ¶
type BaseHandler ¶
type BaseHandler struct {
// contains filtered or unexported fields
}
func (*BaseHandler) Lock ¶
func (b *BaseHandler) Lock()
func (*BaseHandler) UnLock ¶
func (b *BaseHandler) UnLock()
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
func (*Buffer) AppendBool ¶
AppendBool appends a bool to the underlying buffer.
func (*Buffer) AppendByte ¶
AppendByte writes a single byte to the Buffer.
func (*Buffer) AppendBytes ¶
func (*Buffer) AppendFloat ¶
AppendFloat appends a float to the underlying buffer. It doesn't quote NaN or +/- Inf.
func (*Buffer) AppendInt ¶
AppendInt appends an integer to the underlying buffer (assuming base 10).
func (*Buffer) AppendString ¶
AppendString writes a string to the Buffer.
func (*Buffer) AppendUint ¶
AppendUint appends an unsigned integer to the underlying buffer (assuming base 10).
func (*Buffer) Reset ¶
func (b *Buffer) Reset()
Reset resets the underlying byte slice. Subsequent writes re-use the slice's backing array.
func (*Buffer) TrimNewline ¶
func (b *Buffer) TrimNewline()
TrimNewline trims any final "\n" byte from the end of the buffer.
type ILogger ¶ added in v2.0.2
type ILogger interface { Trace(msg string, args ...any) Debug(msg string, args ...any) Info(msg string, args ...any) Warning(msg string, args ...any) Error(msg string, args ...any) Stack(msg string, args ...any) Dump(msg string, args ...any) Fatal(msg string, args ...any) DoSPrintf(level slog.Level, a []interface{}) FormatHeader(buf *Buffer, level slog.Level, calldepth int) Close() }
func NewJsonLogger ¶
type IOriginHandler ¶
type Logger ¶
func (*Logger) FormatHeader ¶ added in v2.0.2
type OriginJsonHandler ¶
type OriginJsonHandler struct { BaseHandler *slog.JSONHandler }
type OriginTextHandler ¶
type OriginTextHandler struct { BaseHandler *slog.TextHandler }
Click to show internal directories.
Click to hide internal directories.