Documentation ¶
Index ¶
- Constants
- type SLogger
- func (l *SLogger) Close() error
- func (l *SLogger) Debug(msg ...interface{})
- func (l *SLogger) Error(msg ...interface{})
- func (l *SLogger) ErrorDepth(depth int, msg ...interface{})
- func (l *SLogger) GetLog(level int) *log.Logger
- func (l *SLogger) GetOutput() io.Writer
- func (l *SLogger) Info(msg ...interface{})
- func (l *SLogger) Log(level int, msg ...interface{})
- func (l *SLogger) SetLevel(level int)
- func (l *SLogger) Warn(msg ...interface{})
Constants ¶
View Source
const ( DEBUG = iota INFO WARN ERROR )
View Source
const ( Ldate = log.Ldate Ltime = log.Ltime Lmicroseconds = log.Lmicroseconds Llongfile = log.Llongfile Lshortfile = log.Lshortfile LUTC = log.LUTC Lmsgprefix = log.Lmsgprefix LstdFlags = log.LstdFlags )
View Source
const DefaultFileName = "./logs/app.log"
默认日志文件路径
View Source
const DefaultFlags = LstdFlags
默认日志flag (Ldate | Ltime)
View Source
const DefaultLevel = INFO
默认打印级别
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SLogger ¶
type SLogger struct {
// contains filtered or unexported fields
}
func New ¶
创建新的日志的打印对象 错误级别为ERROR以上时, 会增加Lshortfile参数 此方法被调用后log的默认设置也会被改变
New(&lumberjack.Logger{ Filename: DefaultFileName, // 日志文件路径 MaxSize: 10, // 单个文件大小(MB) MaxAge: 30, // 备份保存天数 MaxBackups: 100, // 备份保存的个数 LocalTime: true, // 是否使用本地时间,false为UTC时间 Compress: false, // 备份是否进行压缩 }, DefaultFlags, // 日志打印flag,参照log包下的flag说明
DefaultLevel) // 日志的打印级别
func (*SLogger) ErrorDepth ¶
打印Error日志 当前级别小于默认日志级别时,日志会被忽略
Click to show internal directories.
Click to hide internal directories.