Documentation ¶
Overview ¶
Package log/filelog implements advanced writer to log files for "log4go" package with improved algorithm of log rotation.
Index ¶
- type Writer
- func (w *Writer) Close()
- func (w *Writer) LogWrite(rec *log.LogRecord)
- func (w *Writer) Rotate()
- func (w *Writer) SetFormat(format string) *Writer
- func (w *Writer) SetHeadFoot(head, foot string) *Writer
- func (w *Writer) SetRotate(rotate bool) *Writer
- func (w *Writer) SetRotateDaily(daily bool) *Writer
- func (w *Writer) SetRotateLines(maxlines int) *Writer
- func (w *Writer) SetRotateSize(maxsize int) *Writer
- func (w *Writer) SetRotatedFilesExpiration(seconds uint64) *Writer
- func (w *Writer) SetWaitOnClose(yes bool) *Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Represents log writer which writes logs into files. It can rotate files and delete previously rotated but expired now logs.
func (*Writer) Close ¶
func (w *Writer) Close()
Closes current log writer and resources connected with it. By default acts asynchronous, which means that method doesn't wait log writer to be closed. To change this behaviour you must use .SetWaitOnClose() method.
Implementation of log4go.LogWriter interface.
func (*Writer) LogWrite ¶
Writes given log record into file.
Implementation of log4go.LogWriter interface.
func (*Writer) SetFormat ¶
Sets the logging format (chainable). Must be called before the first log message is written.
func (*Writer) SetHeadFoot ¶
Sets the log file header and footer (chainable). Must be called before the first log message is written. These are formatted similar to the log4go.FormatLogRecord (e.g. you can use %D and %T in your header/footer for date and time).
func (*Writer) SetRotate ¶
Changes whether or not the old logs are kept (chainable). Must be called before the first log message is written. If rotate is false, the files are overwritten; otherwise, they are rotated to another file before the new log is opened.
func (*Writer) SetRotateDaily ¶
Sets rotate daily (chainable). Must be called before the first log message is written.
func (*Writer) SetRotateLines ¶
Sets rotate at linecount (chainable). Must be called before the first log message is written.
func (*Writer) SetRotateSize ¶
Sets rotate at size (chainable). Must be called before the first log message is written.
func (*Writer) SetRotatedFilesExpiration ¶
Sets duration (in seconds) of how long already rotated files must be kept (chainable). If is not set, then files will be kept always.
func (*Writer) SetWaitOnClose ¶
Makes .Close() method to wait until Writer will be totally closed. If is not set, by default is false, which means .Close() method to act asynchronous.