Documentation ¶
Overview ¶
Package flog provides facilities for using and managing file-backed logger objects.
Index ¶
- Constants
- Variables
- type BufferedLog
- func (this *BufferedLog) BaseDir() string
- func (this *BufferedLog) Close()
- func (this *BufferedLog) Disable()
- func (this *BufferedLog) Enable()
- func (this *BufferedLog) FlushIntervalSec() int32
- func (this *BufferedLog) Name() string
- func (this *BufferedLog) Print(format string, v ...interface{})
- func (this *BufferedLog) SetFlushIntervalSec(interval int32)
- type DirectLog
- type FLog
Constants ¶
const ( BufferedFile = iota DirectFile )
Enumeration of different FLog implementations.
const DefaultFlushIntervalSec = 5
Default flush interval, in seconds, for BufferedLog instances.
const FLogFlags = log.Ldate | log.Lmicroseconds
Logger format flags.
Log file open flags.
Variables ¶
var FlogCallDepth = 3
FlogCallDepth is used to determine how far up the callstack to look for the calling file:line information when formatting log messages.
Functions ¶
This section is empty.
Types ¶
type BufferedLog ¶
type BufferedLog struct {
// contains filtered or unexported fields
}
BufferedLog represents a buffered, file-backed logger and enforces a standardized logging format. New logging entries are sent to a memory buffer and periodically flushed to the backing file at configurable intervals by a seperate goroutine.
func (*BufferedLog) BaseDir ¶
func (this *BufferedLog) BaseDir() string
BaseDir returns the base directory of the file backing this BufferedLog instance.
func (*BufferedLog) Close ¶
func (this *BufferedLog) Close()
Close disables the BufferedLog instance, flushes any remaining entries to disk, and then closes the backing log file.
func (*BufferedLog) Disable ¶
func (this *BufferedLog) Disable()
Disable temporarily disables the BufferedLog instance. New calls to Print will have no effect.
func (*BufferedLog) Enable ¶
func (this *BufferedLog) Enable()
Enable re-enables an BufferedLog instance.
func (*BufferedLog) FlushIntervalSec ¶
func (this *BufferedLog) FlushIntervalSec() int32
FlushInterval returns the interval between log flushes in seconds.
func (*BufferedLog) Name ¶
func (this *BufferedLog) Name() string
Name returns the friendly name of the log.
func (*BufferedLog) Print ¶
func (this *BufferedLog) Print(format string, v ...interface{})
Print formats and buffers a new log entry as long as the BufferedLog instance is enabled.
func (*BufferedLog) SetFlushIntervalSec ¶
func (this *BufferedLog) SetFlushIntervalSec(interval int32)
SetFlushIntervalSec sets the interval at which the log buffer worker will attempt to flush new entries into the backing log file.
type DirectLog ¶
type DirectLog struct {
// contains filtered or unexported fields
}
DirectLog represents a file-backed logger and enforces a standardized logging format. New logging entries are written immediately to the backing file.
func (*DirectLog) BaseDir ¶
BaseDir returns the base directory of the file backing this DirectLog instance.
func (*DirectLog) Close ¶
func (this *DirectLog) Close()
Close disables the DirectLog instance, flushes any remaining entries to disk, and then closes the backing log file.
func (*DirectLog) Disable ¶
func (this *DirectLog) Disable()
Disable temporarily disables the DirectLog instance. New calls to Print will have no effect.
type FLog ¶
type FLog interface { BaseDir() string Close() Disable() Enable() Name() string Print(format string, v ...interface{}) }
FLog provides a common interface for different file-backed logs. This package includes two primary implementations; BufferedLog and DirectLog.