Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrBadConfig = errors.New("Bad configuration.")
)
Functions ¶
This section is empty.
Types ¶
type LineConfig ¶
type LineLog ¶
type LineLog struct { *Log // contains filtered or unexported fields }
func NewLineLog ¶
func NewLineLog(c LineConfig) (*LineLog, error)
type LogDir ¶
LogDir stores a log directory and a file prefix.
func (LogDir) List ¶
List reads the directory to find numerically labeled log files. For example, if the prefix is "foo" and the directory contains files called ["foo.0", "foo.24", "foobar", "foo.3"], this will return [0, 3, 24]. The result is always sorted in ascending order. The result will never contain duplicate numbers. An error will be returned if the directory listing cannot be read.
func (LogDir) Rotate ¶
Rotate perfroms manual log rotation on a given directory. The max argument determines how many log files should be allowed to exist at once, including the 0 file which will not exist after this call. For example, if the prefix is "foo", max is 3, and the directory contains files called ["foo.0", "foo.1", "foo.2", "foo.3", "foo.4", "foobar"], this will delete "foo.2", "foo.3", and "foo.4". It will rename "foo.1" to "foo.2" and "foo.0" to "foo.1". Usually, you do not need to use this method directly. Log and LineLog run it for you. An error will be returned if the directory cannot be read, if a file cannot be removed, or if a file cannot be renamed.