Documentation
¶
Index ¶
- Constants
- Variables
- type IOManager
- func (m *IOManager) Compress() bool
- func (m *IOManager) Concurency() int
- func (m *IOManager) Enable() chan string
- func (m *IOManager) FileMode() os.FileMode
- func (m *IOManager) IgnoreOK() bool
- func (m *IOManager) LockFree() bool
- func (m *IOManager) NameParts() []string
- func (m *IOManager) ResetFileSize()
- func (m *IOManager) Spining() bool
- func (m *IOManager) WriteN(n int)
- type IOWriter
- type Manager
- type Option
- func WithCompress() Option
- func WithConcurrency(concurency int, spining bool) Option
- func WithDir(dir string) Option
- func WithFileMode(mode uint32) Option
- func WithIgnoreOK() Option
- func WithLockFree() Option
- func WithPath(path string) Option
- func WithPrefix(prefix string) Option
- func WithSuffix(suffix string) Option
- func WithTimePattern(pattern string) Option
- func WithVolumeSize(size string) Option
- type RotatePolicy
Constants ¶
View Source
const ( WithoutRotate = iota TimeRotate VolumeRotate )
Variables ¶
View Source
var ( // BufferSize defined the buffer size // about 2MB BufferSize = 0x6ffffff // ErrInternal defined the internal error ErrInternal = errors.New("error internal") // ErrInvalidArgument defined the invalid argument ErrInvalidArgument = errors.New("error argument invalid") // ErrMakingLogDirFailed means this path can not be created ErrMakingLogDirFailed = errors.New("error in make dir with given path") )
View Source
var ( // Precision defined the precision about how many SECONDS will be waitted before // the reopen operation check the condition Precision = 1 )
Functions ¶
This section is empty.
Types ¶
type IOManager ¶
type IOManager struct {
FilePath string
// file name js like this style: prefix-timestamp-suffix.log
// compressed log file is named like this: prefix-timestamp-suffix.tar
Prefix string
Suffix string
FileMod os.FileMode
IsIgnoreOK bool
IsCompress bool
IsLockFree bool
// pattern is just like the crontable style without year, second minute hour day mounth weekday
RollingTimePattern string
// VolumeSize can be give a size with K M G
RollingVolumeSize string
// TimeFormatPattern defined the rolling time pattern which will used to name the .log file
TimeFormatPattern string
// contains filtered or unexported fields
}
func (*IOManager) Concurency ¶
func (*IOManager) ResetFileSize ¶
func (m *IOManager) ResetFileSize()
type IOWriter ¶
func NewIOWriter ¶
func NewIOWriter(path string, kind RotatePolicy, ops ...Option) (IOWriter, error)
NewIOWriter generate a iofilter writer with given ioManager
type Manager ¶
type Manager interface {
Enable() chan string
WriteN(int)
ResetFileSize()
LockFree() bool
NameParts() []string
FileMode() os.FileMode
Compress() bool
IgnoreOK() bool
Concurency() int
Spining() bool
}
func NewTimeRotateManager ¶
func NewVolumeRotateManager ¶
type Option ¶
type Option func(*IOManager)
func WithCompress ¶
func WithCompress() Option
func WithConcurrency ¶
func WithFileMode ¶
func WithIgnoreOK ¶
func WithIgnoreOK() Option
func WithLockFree ¶
func WithLockFree() Option
func WithPrefix ¶
func WithSuffix ¶
func WithTimePattern ¶
func WithVolumeSize ¶
type RotatePolicy ¶
type RotatePolicy int
Click to show internal directories.
Click to hide internal directories.