Documentation
¶
Overview ¶
RotateWriter interfaces to io.Writer to automaticly rotate the log file based on max size and/or time
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Megabyte int64 = 1024 * 1024 // Variable to use along with MaxSize to use megabytes. Kilobyte int64 = 1024 // Variable to use along with MaxSize to use kilobytes. )
Functions ¶
This section is empty.
Types ¶
type RotateWriter ¶
type RotateWriter struct {
Dir string // the directory to put log files.
Filename string // should be set to the actual filename and extension.
ExpireTime time.Duration // how often the log should rotate.
OldTime time.Duration // what age should logs be considered old.
MaxSize int64 // max size a log file is allowed to be in bytes.
// contains filtered or unexported fields
}
The structure for RotateWriter, which should interface io.Writer
func (*RotateWriter) Janitor ¶
func (w *RotateWriter) Janitor() error
Janitor - cleans up old log files in via directory.
func (*RotateWriter) Resume ¶
func (w *RotateWriter) Resume() error
Create a new log file does not exists, opens if log file does exists.
func (*RotateWriter) Rotate ¶
func (w *RotateWriter) Rotate() error
Perform the actual act of rotating and reopening file.
Click to show internal directories.
Click to hide internal directories.