logger

package
v0.0.0-...-06005b7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoggerLevel0Debug   = iota // 测试信息 绿色
	LoggerLevel1Warning        // 警告信息 黄色
	LoggerLevel2Error          // 错误信息 红色
	LoggerLevel3Fatal          // 严重信息 高亮红色
	LoggerLevel4Trace          // 打印信息 灰色
	LoggerLevel5Off            // 关闭信息
)

...

View Source
const (
	ModeMonth = "month" // 按月压缩模式
	ModeDay   = "day"   // 按日压缩模式
)

...

Variables

This section is empty.

Functions

func NewDefaultWriter

func NewDefaultWriter(option *DefaultWriterOption) io.Writer

NewDefaultWriter ...

Types

type DefaultWriter

type DefaultWriter struct {
	// contains filtered or unexported fields
}

DefaultWriter ...

func (*DefaultWriter) Write

func (o *DefaultWriter) Write(p []byte) (n int, err error)

type DefaultWriterOption

type DefaultWriterOption struct {
	CompressMode  string    // 日志压缩模式 [month|day] month=按月压缩,day=按日压缩
	CompressCount int       // 仅在按日压缩模式下有效,设置为压缩几天前的日志,支持大于等于1的数字
	CompressKeep  int       // 前多少次的压缩文件删除掉,支持month和day模式。默认为0,不删除。例如:1=保留最近1个压缩日志,2=保留最近2个压缩日志,依次类推。。。
	Clone         io.Writer // 日志克隆输出接口
	Path          string    // 日志目录,默认目录:./log
	Label         string    // 日志标签
	Name          string    // 日志文件名
}

DefaultWriterOption ...

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger ...

func NewLogger

func NewLogger(out io.Writer) *Logger

NewLogger ...

func (*Logger) Log0Debug

func (o *Logger) Log0Debug(v ...interface{})

Log0Debug ...

func (*Logger) Log1Warn

func (o *Logger) Log1Warn(v ...interface{})

Log1Warn ...

func (*Logger) Log2Error

func (o *Logger) Log2Error(v ...interface{})

Log2Error ...

func (*Logger) Log3Fatal

func (o *Logger) Log3Fatal(v ...interface{})

Log3Fatal ...

func (*Logger) Log4Trace

func (o *Logger) Log4Trace(v ...interface{})

Log4Trace ...

func (*Logger) LogCalldepth

func (o *Logger) LogCalldepth(calldepth int, level int, msg ...interface{})

LogCalldepth ...

func (*Logger) SetColor

func (o *Logger) SetColor(enable bool)

SetColor Enable/Disable color

func (*Logger) SetFlags

func (o *Logger) SetFlags(flag int)

SetFlags ...

func (*Logger) SetLevel

func (o *Logger) SetLevel(level int)

SetLevel ...

func (*Logger) SetOutput

func (o *Logger) SetOutput(w io.Writer)

SetOutput ...

func (*Logger) SetPrefix

func (o *Logger) SetPrefix(prefix string)

SetPrefix ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL