Versions in this module Expand all Collapse all v4 v4.1.0 Dec 13, 2020 Changes in this version + type FieldBuilder struct + func FB(cap int) FieldBuilder + func NewFieldBuilder(cap int) FieldBuilder + func (fb *FieldBuilder) Reset() + func (fb FieldBuilder) E(err error) FieldBuilder + func (fb FieldBuilder) F(key string, value interface{}) FieldBuilder + func (fb FieldBuilder) Field(key string, value interface{}) FieldBuilder + func (fb FieldBuilder) Fields() []Field + func (fb FieldBuilder) Release() + type FieldError interface + func FE(err error, fields FieldReleaser) FieldError + func NewFieldError(err error, fields FieldReleaser) FieldError + type FieldReleaser interface + Fields func() []Field + Release func() v4.0.0 Oct 17, 2020 Changes in this version + var BuilderSize = 256 + var CallOnExit []func() + var DefalutLogger = New("") + func Debug(msg string, fields ...Field) + func Debugf(msg string, args ...interface{}) + func Ef(err error, format string, args ...interface{}) + func Error(msg string, fields ...Field) + func Errorf(msg string, args ...interface{}) + func Fatal(msg string, fields ...Field) + func Fatalf(msg string, args ...interface{}) + func FieldFunc(key string) func(value interface{}) Field + func Info(msg string, fields ...Field) + func Infof(msg string, args ...interface{}) + func ParseSize(s string) (size int64, err error) + func Printf(msg string, args ...interface{}) + func RegisterCallOnExit(f func()) + func ToIOWriter(w Writer, lvl ...Level) io.WriteCloser + func Trace(msg string, fields ...Field) + func Tracef(msg string, args ...interface{}) + func Warn(msg string, fields ...Field) + func Warnf(msg string, args ...interface{}) + type Builder struct + func NewBuilder(n int) *Builder + func NewBuilderBytes(buf []byte) *Builder + func NewBuilderString(s string) *Builder + func (b *Builder) AppendAny(any interface{}) (ok bool, err error) + func (b *Builder) AppendAnyFmt(any interface{}) error + func (b *Builder) AppendBool(v bool) + func (b *Builder) AppendByte(c byte) + func (b *Builder) AppendFloat(f float64, bitSize int) + func (b *Builder) AppendInt(i int64) + func (b *Builder) AppendJSON(value interface{}) error + func (b *Builder) AppendJSONString(s string) + func (b *Builder) AppendString(s string) + func (b *Builder) AppendTime(t time.Time, layout string) + func (b *Builder) AppendUint(i uint64) + func (b *Builder) Bytes() []byte + func (b *Builder) Cap() int + func (b *Builder) Len() int + func (b *Builder) Reset() + func (b *Builder) ResetBytes(bs []byte) + func (b *Builder) String() string + func (b *Builder) TrimNewline() + func (b *Builder) TruncateAfter(n int) + func (b *Builder) TruncateBefore(n int) + func (b *Builder) Write(bs []byte) (int, error) + func (b *Builder) WriteByte(c byte) error + func (b *Builder) WriteRune(r rune) (int, error) + func (b *Builder) WriteString(s string) (int, error) + func (b *Builder) WriteTo(w io.Writer) (int64, error) + type Encoder interface + Encode func(Record) + SetWriter func(Writer) + Writer func() Writer + func EncoderFunc(w Writer, encode func(*Builder, Record)) Encoder + func FixRecordEncoder(encoder Encoder, fixRecord func(Record) Record) Encoder + func JSONEncoder(w Writer, options ...EncoderOption) Encoder + func LevelEncoder(lvl Level, enc Encoder) Encoder + func NothingEncoder() Encoder + func TextEncoder(w Writer, options ...EncoderOption) Encoder + type EncoderOption interface + func EncodeLevel(key string) EncoderOption + func EncodeLogger(key string) EncoderOption + func EncodeTime(key string, format ...string) EncoderOption + func Newline(newline bool) EncoderOption + func Quote() EncoderOption + type ExtLogger struct + Ctxs []Field + Depth int + Encoder Encoder + Level Level + Name string + func New(name string) *ExtLogger + func NewSimpleLogger(name, level, filePath, fileSize string, fileNum int) (*ExtLogger, error) + func WithCtx(fields ...Field) *ExtLogger + func WithDepth(depth int) *ExtLogger + func WithEncoder(enc Encoder) *ExtLogger + func WithLevel(level Level) *ExtLogger + func WithName(name string) *ExtLogger + func (l *ExtLogger) Clone() *ExtLogger + func (l *ExtLogger) Debug(msg string, fields ...Field) + func (l *ExtLogger) Debugf(msg string, args ...interface{}) + func (l *ExtLogger) Error(msg string, fields ...Field) + func (l *ExtLogger) Errorf(msg string, args ...interface{}) + func (l *ExtLogger) Fatal(msg string, fields ...Field) + func (l *ExtLogger) Fatalf(msg string, args ...interface{}) + func (l *ExtLogger) Info(msg string, fields ...Field) + func (l *ExtLogger) Infof(msg string, args ...interface{}) + func (l *ExtLogger) Log(lvl Level, depth int, msg string, args []interface{}, fields []Field) + func (l *ExtLogger) Printf(msg string, args ...interface{}) + func (l *ExtLogger) StdLog(prefix string, flags ...int) *log.Logger + func (l *ExtLogger) Trace(msg string, fields ...Field) + func (l *ExtLogger) Tracef(msg string, args ...interface{}) + func (l *ExtLogger) Warn(msg string, fields ...Field) + func (l *ExtLogger) Warnf(msg string, args ...interface{}) + func (l *ExtLogger) WithCtx(ctxs ...Field) *ExtLogger + func (l *ExtLogger) WithDepth(depth int) *ExtLogger + func (l *ExtLogger) WithEncoder(e Encoder) *ExtLogger + func (l *ExtLogger) WithLevel(level Level) *ExtLogger + func (l *ExtLogger) WithName(name string) *ExtLogger + type Field interface + Key func() string + Value func() interface{} + func E(err error) Field + func F(key string, value interface{}) Field + type Level uint8 + const LvlDebug + const LvlError + const LvlFatal + const LvlInfo + const LvlTrace + const LvlWarn + func NameToLevel(level string, defaultLevel ...Level) Level + func (l Level) String() string + type Logger interface + Debug func(msg string, fields ...Field) + Error func(msg string, fields ...Field) + Fatal func(mst string, fields ...Field) + Info func(msg string, fields ...Field) + Trace func(msg string, fields ...Field) + Warn func(msg string, fields ...Field) + type Loggerf interface + Debugf func(msgfmt string, args ...interface{}) + Errorf func(msgfmt string, args ...interface{}) + Fatalf func(msgfmt string, args ...interface{}) + Infof func(msgfmt string, args ...interface{}) + Tracef func(msgfmt string, args ...interface{}) + Warnf func(msgfmt string, args ...interface{}) + type Record struct + Ctxs []Field + Depth int + Fields []Field + Lvl Level + Msg string + Name string + Time time.Time + type SizedRotatingFile struct + func NewSizedRotatingFile(filename string, size, count int, mode ...os.FileMode) (*SizedRotatingFile, error) + func (f *SizedRotatingFile) Close() error + func (f *SizedRotatingFile) Flush() error + func (f *SizedRotatingFile) Write(data []byte) (n int, err error) + type StackField interface + Stack func(depth int) interface{} + func Caller(key string, fullPath ...bool) StackField + func CallerStack(key string, fullPath ...bool) StackField + func StackFieldFunc(key string, getStack func(depth int) interface{}) StackField + type Writer interface + WriteLevel func(level Level, data []byte) (n int, err error) + func BufferWriter(w Writer, bufferSize int) Writer + func DiscardWriter() Writer + func FailoverWriter(writers ...Writer) Writer + func FileWriter(filename, filesize string, filenum int) (Writer, error) + func LevelWriter(lvl Level, w Writer) Writer + func NetWriter(network, addr string) (Writer, error) + func SafeWriter(w Writer) Writer + func SplitWriter(getWriter func(Level) Writer) Writer + func StreamWriter(w io.Writer) Writer + func SyslogNetWriter(net, addr string, priority syslog.Priority, tag string) (Writer, error) + func SyslogWriter(priority syslog.Priority, tag string) (Writer, error) + func WriterFunc(write func(Level, []byte) (int, error), close ...func() error) Writer Other modules containing this package github.com/xgfone/klog github.com/xgfone/klog/v2 github.com/xgfone/klog/v3