Versions in this module Expand all Collapse all v0 v0.1.1 May 5, 2023 v0.1.0 May 4, 2023 Changes in this version + const DefaultBackNum + const DefaultBackTime + const DefaultMaxSize + const OneMByte + var DefaultFileFlags = os.O_CREATE | os.O_WRONLY | os.O_APPEND + var DefaultFilePerm os.FileMode = 0664 + var DefaultFilenameFn = func(filepath string, rotateNum uint) string + var DefaultTimeClockFn = ClockFn(func() time.Time { ... }) + type CConfig struct + BackupNum uint + BackupTime uint + Compress bool + FileDirs []string + TimeClock Clocker + func NewCConfig() *CConfig + func (c *CConfig) AddFileDir(dirs ...string) *CConfig + type ClockFn func() time.Time + func (fn ClockFn) Now() time.Time + type Clocker interface + Now func() time.Time + type Config struct + BackupNum uint + BackupTime uint + CloseLock bool + Compress bool + Filepath string + MaxSize uint64 + RenameFunc func(filePath string, rotateNum uint) string + RotateTime RotateTime + TimeClock Clocker + func EmptyConfigWith(fns ...ConfigFn) *Config + func NewConfig(filePath string) *Config + func NewConfigWith(fns ...ConfigFn) *Config + func NewDefaultConfig() *Config + func (c *Config) Create() (*Writer, error) + func (c *Config) With(fns ...ConfigFn) *Config + type ConfigFn func(c *Config) + func WithFilepath(logfile string) ConfigFn + type FilesClear struct + func NewFilesClear(cfg *CConfig) *FilesClear + func (r *FilesClear) Clean() (err error) + func (r *FilesClear) CleanDaemon() + func (r *FilesClear) WithConfigFn(fn func(c *CConfig)) *FilesClear + type RotateTime int + const Every15Min + const Every30Min + const EveryDay + const EveryHour + const EveryMinute + const EverySecond + func (rt RotateTime) FirstCheckTime(now time.Time) int64 + func (rt RotateTime) Interval() int64 + func (rt RotateTime) String() string + func (rt RotateTime) TimeFormat() (suffixFormat string) + type RotateWriter interface + Clean func() error + Flush func() error + Rotate func() error + Sync func() error + type Writer struct + func NewWriter(c *Config) (*Writer, error) + func NewWriterWith(fns ...ConfigFn) (*Writer, error) + func (d *Writer) Clean() (err error) + func (d *Writer) Close() error + func (d *Writer) Config() Config + func (d *Writer) Flush() error + func (d *Writer) ReopenFile() error + func (d *Writer) Rotate() (err error) + func (d *Writer) Sync() error + func (d *Writer) Write(p []byte) (n int, err error) + func (d *Writer) WriteString(s string) (n int, err error)