Versions in this module Expand all Collapse all v3 v3.2.0 Jun 5, 2020 Changes in this version + var CallOnExit []func() + func RegisterCallOnExit(f func()) v3.1.0 Apr 26, 2020 Changes in this version + func Fatal(msg string, fields ...Field) + func Fatalf(format string, args ...interface{}) + func Panic(msg string, fields ...Field) + func Panicf(format string, args ...interface{}) v3.0.0 Jan 7, 2020 Changes in this version + var BuilderSize = 256 + var Levels = map[string]Level + var LvlCrit = NewLevel("CRIT", 500) + var LvlDebug = NewLevel("DEBUG", 100) + var LvlEmerg = NewLevel("EMERG", 600) + var LvlError = NewLevel("ERROR", 400) + var LvlInfo = NewLevel("INFO", 200) + var LvlMax = NewLevel("MAX", math.MaxInt32) + var LvlTrace = NewLevel("TRACE", 0) + var LvlWarn = NewLevel("WARN", 300) + func Debug(msg string, fields ...Field) + func Debugf(format string, args ...interface{}) + func Ef(err error, format string, args ...interface{}) + func Error(msg string, fields ...Field) + func Errorf(format string, args ...interface{}) + func Info(msg string, fields ...Field) + func Infof(format string, args ...interface{}) + func Log(level Level, msg string, fields ...Field) + func NewStdLogger(w Writer, prefix string, flags ...int) *log.Logger + func ParseSize(s string) (size int64, err error) + func Printf(format string, args ...interface{}) + func SetDefaultLogger(l ExtLogger) + func SetEncoder(enc Encoder) + func SetLevel(lvl Level) + func Sprintf(msg string, args ...interface{}) string + func ToIOWriter(w Writer) io.WriteCloser + func Trace(msg string, fields ...Field) + func Tracef(format string, args ...interface{}) + func UpdateDefaultLogger(level, filePath, fileSize string, fileNum int) error + func Warn(msg string, fields ...Field) + func Warnf(format 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 GetEncoder() Encoder + func GetEncoderFromLogger(logger Logger, defaultEncoder ...Encoder) 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 interface + Encoder func() Encoder + SetEncoder func(Encoder) + SetLevel func(level Level) + WithCtx func(fields ...Field) ExtLogger + WithDepth func(depth int) ExtLogger + WithEncoder func(e Encoder) ExtLogger + WithLevel func(level Level) ExtLogger + WithName func(name string) ExtLogger + func GetDefaultLogger() ExtLogger + 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 + type Field interface + Key func() string + Value func() interface{} + func E(err error) Field + func F(key string, value interface{}) Field + type FmtLogger interface + Debugf func(format string, args ...interface{}) + Errorf func(format string, args ...interface{}) + Infof func(format string, args ...interface{}) + Tracef func(format string, args ...interface{}) + Warnf func(format string, args ...interface{}) + func ToFmtLogger(logger ExtLogger) FmtLogger + type Level interface + Priority func() int + String func() string + func NameToLevel(name string, defaultPanic ...bool) Level + func NewLevel(name string, priority int) Level + type LevelLogger interface + Debug func(msg string, fields ...Field) + Error func(msg string, fields ...Field) + Info func(msg string, fields ...Field) + Trace func(msg string, fields ...Field) + Warn func(msg string, fields ...Field) + func ToLevelLogger(logger ExtLogger) LevelLogger + type Logger interface + Log func(level Level, msg string, fields ...Field) + type Printfer interface + Printf func(msg string, args ...interface{}) + func ToPrintfer(logger ExtLogger) Printfer + 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 NewSizedRotatingFileWithoutLock(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 WriteCloser interface + func SyslogNetWriter(net, addr string, priority syslog.Priority, tag string) (WriteCloser, error) + func SyslogWriter(priority syslog.Priority, tag string) (WriteCloser, error) + func ToWriteCloser(w Writer) WriteCloser + func WriteCloserFunc(write func(Level, []byte) (int, error), close func() error) WriteCloser + type WriteFlushCloser interface + Flush func() error + func BufferWriter(w Writer, bufferSize int) WriteFlushCloser + func DiscardWriter() WriteFlushCloser + func FailoverWriter(writers ...Writer) WriteFlushCloser + func FileWriter(filename, filesize string, filenum int) (WriteFlushCloser, error) + func FileWriterWithoutLock(filename, filesize string, filenum int) (WriteFlushCloser, error) + func LevelWriter(lvl Level, w Writer) WriteFlushCloser + func NetWriter(network, addr string) (WriteFlushCloser, error) + func SafeWriter(w Writer) WriteFlushCloser + func SplitWriter(getWriter func(Level) Writer, flush ...func() error) WriteFlushCloser + func StreamWriter(w io.Writer) WriteFlushCloser + func ToWriteFlushCloser(w Writer) WriteFlushCloser + func WriteFlushCloserFunc(write func(Level, []byte) (int, error), flush, close func() error) WriteFlushCloser + type Writer interface + Write func(level Level, data []byte) (n int, err error) + func WriterFunc(f func(Level, []byte) (int, error)) Writer Other modules containing this package github.com/xgfone/klog github.com/xgfone/klog/v2 github.com/xgfone/klog/v4