Documentation
¶
Overview ¶
Package logrotate provides a size-based rotating log writer. It implements io.Writer and io.Closer, safe for concurrent use.
Index ¶
Constants ¶
View Source
const ( // DefaultMaxSize is the default maximum log file size before rotation (10 MiB). DefaultMaxSize = 10 * 1024 * 1024 // DefaultMaxBackups is the default number of backup files to retain. DefaultMaxBackups = 5 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Writer ¶
type Writer struct {
// Path is the absolute path to the active log file.
Path string
// MaxSize is the maximum file size in bytes before rotation.
// Zero or negative uses DefaultMaxSize.
MaxSize int64
// MaxBackups is the number of backup files to retain.
// Zero or negative uses DefaultMaxBackups.
MaxBackups int
// contains filtered or unexported fields
}
Writer is an io.WriteCloser that writes to Path and rotates the file when its size exceeds MaxSize. Backup files are named Path.1, Path.2, … At most MaxBackups backup files are kept; older ones are deleted.
Click to show internal directories.
Click to hide internal directories.