Documentation ¶
Index ¶
- Variables
- func AddLogger(id string, typestr string, onMsg func(rec *GoLogRecord) bool)
- func ConsoleLogMsg(rec *GoLogRecord) bool
- func DelLogger(id string, typestr string)
- func FormatLogRecord(format string, rec *GoLogRecord) []byte
- func Log3Msgf(callskip int, s string, args ...interface{})
- func LogMsg(typestr string, lvl int8, callskip int, msg interface{})
- func LogMsgf(typestr string, lvl int8, callskip int, s string, args ...interface{})
- func RenameLogFile(filename string) (newfile string, err error)
- type CacheMultiFileWriter
- type GoLog
- func (this *GoLog) AddLogger(id string, typestr string, onMsg func(rec *GoLogRecord) bool)
- func (this *GoLog) DelLogger(id string, typestr string)
- func (this *GoLog) LogMsg(typestr string, lvl int8, callskip int, msg interface{})
- func (this *GoLog) LogMsgf(typestr string, lvl int8, callskip int, s string, args ...interface{})
- type GoLogRecord
- type MultiFile
- type SingleCacheFileWriter
- func (this *SingleCacheFileWriter) Close() error
- func (this *SingleCacheFileWriter) GetFileName() string
- func (this *SingleCacheFileWriter) GetTotleCount() int
- func (this *SingleCacheFileWriter) OnLogMsg(rec *GoLogRecord) bool
- func (this *SingleCacheFileWriter) SetMaxSize(v int)
- func (this *SingleCacheFileWriter) SetMsgFmt(s string)
- func (this *SingleCacheFileWriter) WaitIdle()
- func (this *SingleCacheFileWriter) WriteMsgf(msglvl int8, s string, args ...interface{}) bool
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultMultiFile = NewMultiFile()
)
Functions ¶
func AddLogger ¶
func AddLogger(id string, typestr string, onMsg func(rec *GoLogRecord) bool)
回调中onMsg函数中rec参数不能进行异步使用
func FormatLogRecord ¶
func FormatLogRecord(format string, rec *GoLogRecord) []byte
Ignores unknown formats Recommended: "[%D %T] [%L] (%S) %M"
Types ¶
type CacheMultiFileWriter ¶
type CacheMultiFileWriter struct { MsgLvl int8 // 大于该值的lvl 才会记录(默认为:0) // 一个文件完成写入后事件 OnFileEof func(filename string) // contains filtered or unexported fields }
func NewCacheMultiFileWriter ¶
func NewCacheMultiFileWriter(filename string) *CacheMultiFileWriter
func (*CacheMultiFileWriter) OnLogMsg ¶
func (this *CacheMultiFileWriter) OnLogMsg(rec *GoLogRecord) bool
func (*CacheMultiFileWriter) SetMaxSize ¶
func (this *CacheMultiFileWriter) SetMaxSize(v int)
func (*CacheMultiFileWriter) SetMsgFmt ¶
func (this *CacheMultiFileWriter) SetMsgFmt(s string)
func (*CacheMultiFileWriter) WaitIdle ¶
func (this *CacheMultiFileWriter) WaitIdle()
type GoLog ¶
type GoLog struct {
// contains filtered or unexported fields
}
func (*GoLog) AddLogger ¶
func (this *GoLog) AddLogger(id string, typestr string, onMsg func(rec *GoLogRecord) bool)
id: 唯一, typestr下id是唯一的, 重复添加会覆盖id的上一次回调 typestr : * 代表所有
type GoLogRecord ¶
type MultiFile ¶
type MultiFile struct {
// contains filtered or unexported fields
}
func NewMultiFile ¶
func NewMultiFile() *MultiFile
func (*MultiFile) CheckGet ¶
func (this *MultiFile) CheckGet(filename string) *SingleCacheFileWriter
type SingleCacheFileWriter ¶
type SingleCacheFileWriter struct { MsgLvl int8 // 大于该值的lvl 才会记录(默认为:0) // 一个文件完成写入后事件 OnFileEof func(filename string) // contains filtered or unexported fields }
func NewSingleCacheFileWriter ¶
func NewSingleCacheFileWriter(filename string) *SingleCacheFileWriter
func (*SingleCacheFileWriter) Close ¶
func (this *SingleCacheFileWriter) Close() error
Close后, 实例不再使用
func (*SingleCacheFileWriter) GetFileName ¶ added in v1.2.24041
func (this *SingleCacheFileWriter) GetFileName() string
func (*SingleCacheFileWriter) GetTotleCount ¶
func (this *SingleCacheFileWriter) GetTotleCount() int
func (*SingleCacheFileWriter) OnLogMsg ¶
func (this *SingleCacheFileWriter) OnLogMsg(rec *GoLogRecord) bool
AddLogger 函数
func (*SingleCacheFileWriter) SetMaxSize ¶
func (this *SingleCacheFileWriter) SetMaxSize(v int)
func (*SingleCacheFileWriter) SetMsgFmt ¶
func (this *SingleCacheFileWriter) SetMsgFmt(s string)
func (*SingleCacheFileWriter) WaitIdle ¶
func (this *SingleCacheFileWriter) WaitIdle()
Click to show internal directories.
Click to hide internal directories.