Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logfile ¶
type Logfile struct {
// contains filtered or unexported fields
}
Logfile struct defines the elements of a Logfile: a pointer to an os.File, as well as its path in a string format and an indicator on when to rotate this file (size in megabytes)
func New ¶
NewLogFile function use the target file as a Logfile, as indicated in the path string; returning a pointer to a Logfile and an error.
If this file does not exist, then it will be created. If the file already exists, then it will be loaded -- and rotated if its too heavy.
func (*Logfile) IsTooHeavy ¶
IsTooHeavy method will verify the file's size and rotate it if exceeding the set maximum weight (in the Logfile's rotate element)
func (*Logfile) MaxSize ¶
MaxSize method will define the rotation indicator for the Logfile, or, the target size when should the logfile be rotated (in MBs)
func (*Logfile) Rotate ¶
Rotate method will rename the existing (overweight) logfile to append a timestamp, and create a new Logfile based on the original filename. The new file will be the target of subsequent writes.