Documentation ¶
Index ¶
- Constants
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- func Warning(v ...interface{})
- func Warningf(format string, v ...interface{})
- type Config
- type XLogger
- func (x *XLogger) Debug(v ...interface{})
- func (x *XLogger) Debugf(format string, v ...interface{})
- func (x *XLogger) Error(v ...interface{})
- func (x *XLogger) Errorf(format string, v ...interface{})
- func (x *XLogger) Fatal(v ...interface{})
- func (x *XLogger) Fatalf(format string, v ...interface{})
- func (x *XLogger) FilePath(path string)
- func (x *XLogger) Flags(flags int)
- func (x *XLogger) GetLevel() int
- func (x *XLogger) GetLevelPrefix(level int) string
- func (x *XLogger) Info(v ...interface{})
- func (x *XLogger) Infof(format string, v ...interface{})
- func (x *XLogger) Panic(v ...interface{})
- func (x *XLogger) Panicf(format string, v ...interface{})
- func (x *XLogger) Prefix(v string)
- func (x *XLogger) PrintErrStack(print bool)
- func (x *XLogger) Printf(format string, v ...interface{})
- func (x *XLogger) Println(v ...interface{})
- func (x *XLogger) SetLevel(level int)
- func (x *XLogger) SetLevelPrefix(level int, prefix string)
- func (x *XLogger) StdPrint(print bool)
- func (x *XLogger) StdPrintLevelColor(print bool)
- func (x *XLogger) Warning(v ...interface{})
- func (x *XLogger) Warningf(format string, v ...interface{})
- func (x *XLogger) Writer(w io.Writer)
Constants ¶
View Source
const ( FileShort = 1 << iota // 文件简短名, 如: test.go:11 FileLong // 文件全路径, 如: /a/b/c/test.go:11 XLogDate // 日期, 如: 2008-02-22 XLogTime // 时间, 如: 01:23:23 XLogTimeMill // 毫秒级时间, 如: 01:23:23.675 FileTimeStd = XLogDate | XLogTimeMill )
View Source
const ( LevelDebug = 1 << iota LevelInfo LevelWarn LevelError LevelPanic LevelFatal LevelDev = LevelDebug | LevelInfo | LevelWarn | LevelError | LevelFatal | LevelPanic LevelProd = LevelInfo | LevelWarn | LevelError | LevelFatal | LevelPanic )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { StdPrint bool // 是否输出到控制台 StdPrintLevelColor bool // 根据内容打印颜色, 如果要写入日志文件的话, 这里将失效 PrintErrStack bool // log err 时是否要打印堆栈信息 Writer io.Writer Flags int // log 标记 Level int // 日志级别 Prefix string // 前缀 FilePath string // 日志文件 LevelPrefixes map[int]string // 自定义前缀 }
Config logger 配置
type XLogger ¶
type XLogger struct {
// contains filtered or unexported fields
}
XLogger 默认按天进行分割
func (*XLogger) GetLevelPrefix ¶
GetLevelPrefix 获取日志前缀
func (*XLogger) PrintErrStack ¶
PrintErrStack 是否要打印 stack
func (*XLogger) SetLevelPrefix ¶
SetLevelPrefix 设置日志前缀
func (*XLogger) StdPrintLevelColor ¶
StdPrintLevelColor 是否需要对日志级别标记颜色
Click to show internal directories.
Click to hide internal directories.