Documentation
¶
Index ¶
Constants ¶
const (
RotateDaily = "2006-01-02"
)
RotateFormat
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
FileWriter create file log writer
func New ¶
func New(fpath string, fns ...Option) (*FileWriter, error)
New FileWriter A FileWriter is safe for use by multiple goroutines simultaneously.
func (*FileWriter) Write ¶
func (f *FileWriter) Write(p []byte) (int, error)
Write write data to log file, return write bytes is pseudo just for implement io.Writer.
type Option ¶
type Option func(opt *option)
Option filewriter option
func ChanSize ¶
ChanSize set internal chan size default 8192 use about 64k memory on x64 platfrom static, because filewriter has internal object pool, change chan size bigger may cause filewriter use a lot of memory, because sync.Pool can't set expire time memory won't free until program exit.
func MaxFile ¶
MaxFile default 999, 0 meaning unlimit. TODO: don't create file list if MaxSize is unlimt.
func MaxSize ¶
MaxSize set max size for single log file, defult 1GB, 0 meaning unlimit.