Documentation
¶
Index ¶
- Constants
- type BaseLogFile
- type LogFile
- type SizeRotateLogFile
- func (l *SizeRotateLogFile) Close() error
- func (l *SizeRotateLogFile) Flush() error
- func (l *SizeRotateLogFile) Path() string
- func (l *SizeRotateLogFile) Rotate() error
- func (l *SizeRotateLogFile) SetRefreshRate(rate time.Duration)
- func (l *SizeRotateLogFile) Write(b []byte) (int, error)
- func (l *SizeRotateLogFile) WriteString(s string) (int, error)
- type TimeRotateLogFile
Constants ¶
const ( //KB Kilobytes KB = 1 << (10 * iota) //MB Megabytes MB //GB Gigabytes GB //TB Terabytes TB // DefaultRotationRate defines the default value for rotation refresh rate DefaultRotationRate = time.Millisecond * 250 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseLogFile ¶ added in v1.1.2
BaseLogFile structure definition
func (*BaseLogFile) Close ¶ added in v1.1.2
func (b *BaseLogFile) Close() error
Close implements LogFile interface
func (*BaseLogFile) Path ¶ added in v1.1.2
func (b *BaseLogFile) Path() string
Path implements LogFile interface
type LogFile ¶
type LogFile interface {
// Path returns the path of the current LogFile
Path() string
// Rotate ensures file rotation
Rotate() error
// Write used to write to the LogFile
Write([]byte) (int, error)
// Close used to close the LogFile
Close() error
}
LogFile interface
type SizeRotateLogFile ¶ added in v1.1.2
SizeRotateLogFile structure definition A SizeRotateLogFile is a GZIP compressed file which rotates automatically
func (*SizeRotateLogFile) Close ¶ added in v1.1.2
func (l *SizeRotateLogFile) Close() error
Close closes the LogFileSizeRotate properly
func (*SizeRotateLogFile) Flush ¶ added in v1.1.2
func (l *SizeRotateLogFile) Flush() error
Flush method
func (*SizeRotateLogFile) Path ¶ added in v1.1.2
func (l *SizeRotateLogFile) Path() string
Path returns the path of the LogFileSizeRotate
func (*SizeRotateLogFile) Rotate ¶ added in v1.1.2
func (l *SizeRotateLogFile) Rotate() error
Rotate rotates the current LogFileSizeRotate
func (*SizeRotateLogFile) SetRefreshRate ¶ added in v1.1.2
func (l *SizeRotateLogFile) SetRefreshRate(rate time.Duration)
SetRefreshRate sets the rate at which the LogFileSizeRotate should check for rotating check DefaultRotationRate for default value
func (*SizeRotateLogFile) Write ¶ added in v1.1.2
func (l *SizeRotateLogFile) Write(b []byte) (int, error)
Write writes bytes into the LogFileSizeRotate
func (*SizeRotateLogFile) WriteString ¶ added in v1.1.2
func (l *SizeRotateLogFile) WriteString(s string) (int, error)
WriteString writes a string into the LogFileSizeRotate
type TimeRotateLogFile ¶ added in v1.1.2
type TimeRotateLogFile struct {
BaseLogFile
// contains filtered or unexported fields
}
TimeRotateLogFile structure definition. A TimeRotateLogFile rotates at whenever rotation delay expires. The current file being used is in plain-text. Whenever the rotation happens, the file is GZIP-ed to save space on disk. A delay can be specified in order to wait before the file is compressed.
func OpenTimeRotateLogFile ¶ added in v1.1.2
func OpenTimeRotateLogFile(path string, perm os.FileMode, drot time.Duration, dgzip time.Duration) (l *TimeRotateLogFile, err error)
OpenTimeRotateLogFile opens a new TimeRotateLogFile drot controls the rotation delay and dgzip the time to wait before the latest file is GZIPed
func (*TimeRotateLogFile) Close ¶ added in v1.1.2
func (l *TimeRotateLogFile) Close() error
Close implements LogFile interface. Whenever the TimeRotateLogFile is closed the last file in use is GZIP compressed before Close returns
func (*TimeRotateLogFile) Rotate ¶ added in v1.1.2
func (l *TimeRotateLogFile) Rotate() (err error)
Rotate implements LogFile interface