Documentation ¶
Index ¶
- Constants
- func Any(key string, value any) arg
- func Blue(msg string) string
- func Bool(key string, value bool) arg
- func Cyan(msg string) string
- func Duration(key string, value time.Duration) arg
- func Error(key string, value error) arg
- func Float32(key string, value float32) arg
- func Float64(key string, value float64) arg
- func Green(msg string) string
- func HiBlue(msg string) string
- func HiCyan(msg string) string
- func HiGreen(msg string) string
- func HiMagenta(msg string) string
- func HiRed(msg string) string
- func HiWhite(msg string) string
- func HiYellow(msg string) string
- func Int(key string, value int) arg
- func Int16(key string, value int16) arg
- func Int32(key string, value int32) arg
- func Int64(key string, value int64) arg
- func Int8(key string, value int8) arg
- func Magenta(msg string) string
- func Map(key string, value M) arg
- func NewLogContext() *logContext
- func Red(msg string) string
- func Slice(key string, value []any) arg
- func Slice2(key string, value ...any) arg
- func Slice3[T any](key string, value []T) arg
- func SortedMap(key string, value ...Pair) arg
- func String(key string, value string) arg
- func Time(key string, value time.Time) arg
- func UInt(key string, value uint) arg
- func UInt16(key string, value uint16) arg
- func UInt32(key string, value uint32) arg
- func UInt64(key string, value uint64) arg
- func UInt8(key string, value uint8) arg
- func White(msg string) string
- func Yellow(msg string) string
- type EncoderType
- type JsonEncoder
- func (lc JsonEncoder) BuildConsoleLogger(level LevelType) Logger
- func (lc JsonEncoder) BuildFileLogger(level LevelType, fsWriter *os.File) Logger
- func (lc JsonEncoder) Copy() *logContext
- func (enc *JsonEncoder) Encode(w *bytes.Buffer, msg string, args ...arg) error
- func (enc *JsonEncoder) Init()
- func (lc JsonEncoder) WithCaller(enable, fileName, funcName, lineNumber bool) *logContext
- func (lc JsonEncoder) WithColor(enable bool) *logContext
- func (lc JsonEncoder) WithEncoder(encoder EncoderType) *logContext
- func (lc JsonEncoder) WithEscapeQuote(enable bool) *logContext
- func (lc JsonEncoder) WithLevel(enable, lower bool) *logContext
- func (lc JsonEncoder) WithPrefix(keyAndValues ...Pair) *logContext
- func (lc JsonEncoder) WithTime(enable bool, format func(time.Time) any) *logContext
- func (lc JsonEncoder) WithWriter(writer io.Writer) *logContext
- type LevelType
- type Logger
- type LoggerX
- func (l *LoggerX) Debug(msg string, args ...arg)
- func (l *LoggerX) Debugf(format string, args ...any)
- func (l *LoggerX) Error(msg string, args ...arg)
- func (l *LoggerX) ErrorBy(err error)
- func (l *LoggerX) Errorf(format string, args ...any)
- func (l *LoggerX) Fatal(msg string, args ...arg)
- func (l *LoggerX) FatalBy(err error)
- func (l *LoggerX) Fatalf(format string, args ...any)
- func (l *LoggerX) Info(msg string, args ...arg)
- func (l *LoggerX) Infof(format string, args ...any)
- func (l *LoggerX) Panic(msg string, args ...arg)
- func (l *LoggerX) PanicBy(err error)
- func (l *LoggerX) Panicf(format string, args ...any)
- func (l *LoggerX) Trace(msg string, args ...arg)
- func (l *LoggerX) Tracef(format string, args ...any)
- func (l *LoggerX) Warn(msg string, args ...arg)
- func (l *LoggerX) Warnf(format string, args ...any)
- func (l *LoggerX) WithPrefix(keyValues map[string]any) Logger
- func (l *LoggerX) WithPrefix2(keyValues ...any) Logger
- type M
- type Pair
- type SimpleEncoder
- func (lc SimpleEncoder) BuildConsoleLogger(level LevelType) Logger
- func (lc SimpleEncoder) BuildFileLogger(level LevelType, fsWriter *os.File) Logger
- func (lc SimpleEncoder) Copy() *logContext
- func (enc *SimpleEncoder) Encode(w *bytes.Buffer, msg string, _ ...arg) error
- func (enc *SimpleEncoder) Init()
- func (lc SimpleEncoder) WithCaller(enable, fileName, funcName, lineNumber bool) *logContext
- func (lc SimpleEncoder) WithColor(enable bool) *logContext
- func (lc SimpleEncoder) WithEncoder(encoder EncoderType) *logContext
- func (lc SimpleEncoder) WithEscapeQuote(enable bool) *logContext
- func (lc SimpleEncoder) WithLevel(enable, lower bool) *logContext
- func (lc SimpleEncoder) WithPrefix(keyAndValues ...Pair) *logContext
- func (lc SimpleEncoder) WithTime(enable bool, format func(time.Time) any) *logContext
- func (lc SimpleEncoder) WithWriter(writer io.Writer) *logContext
Constants ¶
View Source
const ( GreenAttr = iota YellowAttr BlueAttr RedAttr CyanAttr MagentaAttr WhiteAttr HiGreenAttr HiYellowAttr HiBlueAttr HiRedAttr HiCyanAttr HiMagentaAttr HiWhiteAttr )
Variables ¶
This section is empty.
Functions ¶
func NewLogContext ¶
func NewLogContext() *logContext
Types ¶
type EncoderType ¶
type EncoderType byte
const ( // Simple Encode does't support key-value args, only message field can be set Simple EncoderType = 1 << iota Json )
type JsonEncoder ¶
type JsonEncoder struct {
// contains filtered or unexported fields
}
func (JsonEncoder) BuildConsoleLogger ¶
func (JsonEncoder) BuildFileLogger ¶
func (*JsonEncoder) Encode ¶
func (enc *JsonEncoder) Encode(w *bytes.Buffer, msg string, args ...arg) error
func (*JsonEncoder) Init ¶
func (enc *JsonEncoder) Init()
func (JsonEncoder) WithCaller ¶
func (lc JsonEncoder) WithCaller(enable, fileName, funcName, lineNumber bool) *logContext
func (JsonEncoder) WithEncoder ¶
func (lc JsonEncoder) WithEncoder(encoder EncoderType) *logContext
func (JsonEncoder) WithEscapeQuote ¶
func (lc JsonEncoder) WithEscapeQuote(enable bool) *logContext
func (JsonEncoder) WithPrefix ¶
func (lc JsonEncoder) WithPrefix(keyAndValues ...Pair) *logContext
func (JsonEncoder) WithWriter ¶
type Logger ¶
type Logger interface { Trace(msg string, args ...arg) Debug(msg string, args ...arg) Info(msg string, args ...arg) Warn(msg string, args ...arg) Error(msg string, args ...arg) Fatal(msg string, args ...arg) Panic(msg string, args ...arg) Tracef(format string, args ...any) Debugf(format string, args ...any) Infof(format string, args ...any) Warnf(format string, args ...any) Errorf(format string, args ...any) Panicf(format string, args ...any) Fatalf(format string, args ...any) PanicBy(err error) ErrorBy(err error) FatalBy(err error) WithPrefix(keyValues map[string]any) Logger WithPrefix2(keyValues ...any) Logger }
type LoggerX ¶
type LoggerX struct {
// contains filtered or unexported fields
}
func (*LoggerX) WithPrefix2 ¶
type SimpleEncoder ¶
type SimpleEncoder struct {
// contains filtered or unexported fields
}
func (SimpleEncoder) BuildConsoleLogger ¶
func (SimpleEncoder) BuildFileLogger ¶
func (*SimpleEncoder) Encode ¶
func (enc *SimpleEncoder) Encode(w *bytes.Buffer, msg string, _ ...arg) error
func (*SimpleEncoder) Init ¶
func (enc *SimpleEncoder) Init()
func (SimpleEncoder) WithCaller ¶
func (lc SimpleEncoder) WithCaller(enable, fileName, funcName, lineNumber bool) *logContext
func (SimpleEncoder) WithEncoder ¶
func (lc SimpleEncoder) WithEncoder(encoder EncoderType) *logContext
func (SimpleEncoder) WithEscapeQuote ¶
func (lc SimpleEncoder) WithEscapeQuote(enable bool) *logContext
func (SimpleEncoder) WithPrefix ¶
func (lc SimpleEncoder) WithPrefix(keyAndValues ...Pair) *logContext
func (SimpleEncoder) WithWriter ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.