Package rotate implements a Writer that will write to files in a directory and rotate them when they reach a specific size. It will also only keep a fixed number of files. It can be used anywhere an io.Writer is used, for example in log.SetOutput().
FilePerm defines the permissions that Writer will use for all the files it creates.
RootPerm defines the permissions that Writer will use if it needs to create the root directory.
Writer implements the io.Writer interface and writes to the "current" file in the root directory. When current's size exceeds max, it is renamed and a new file is created.
New creates a new Writer. The files will be created in the root directory. root will be created if necessary. The filenames will start with prefix.
Close closes the current file. Writer is unusable after this is called.
SetKeep sets the number of archived files to keep.
SetMax sets the maximum size for a file in bytes.
Write writes p to the current file, then checks to see if rotation is necessary.