Versions in this module Expand all Collapse all v0 v0.1.0 Jul 17, 2020 Changes in this version + const TimeRolling + const VolumeRolling + const WithoutRolling + var BufferSize = 0x100000 + var DefualtFileFlag = os.O_RDWR | os.O_CREATE | os.O_APPEND + var DefualtFileMode = os.FileMode(0644) + var ErrClosed = errors.New("error write on close") + var ErrInternal = errors.New("error internal") + var ErrInvalidArgument = errors.New("error argument invalid") + var Precision = 1 + var QueueSize = 1024 + func LogFilePath(c *Config) (filepath string) + type AsynchronousWriter struct + func (w *AsynchronousWriter) Close() error + func (w *AsynchronousWriter) Write(b []byte) (int, error) + type BufferWriter struct + func (w *BufferWriter) Write(b []byte) (int, error) + func (w BufferWriter) Close() error + type Config struct + BufferWriterThreshold int + Compress bool + FileName string + LogPath string + MaxRemain int + RollingPolicy int + RollingTimePattern string + RollingVolumeSize string + TimeTagFormat string + WriterMode string + func NewDefaultConfig() Config + type LockedWriter struct + func (w *LockedWriter) Close() error + func (w *LockedWriter) Write(b []byte) (n int, err error) + type Manager interface + Close func() + Fire func() chan string + func NewManager(c *Config) (Manager, error) + type Option func(*Config) + func WithAsynchronous() Option + func WithBuffer() Option + func WithBufferThreshold(n int) Option + func WithCompress() Option + func WithFileName(name string) Option + func WithLock() Option + func WithLogPath(path string) Option + func WithMaxRemain(max int) Option + func WithRollingTimePattern(pattern string) Option + func WithRollingVolumeSize(size string) Option + func WithTimeTagFormat(format string) Option + func WithoutRollingPolicy() Option + type RollingWriter interface + Close func() error + func NewWriter(ops ...Option) (RollingWriter, error) + func NewWriterFromConfig(c *Config) (RollingWriter, error) + func NewWriterFromConfigFile(path string, typ string) (RollingWriter, error) + type Writer struct + func (w *Writer) Close() error + func (w *Writer) CompressFile(oldfile *os.File, cmpname string) error + func (w *Writer) DoRemove() + func (w *Writer) Reopen(file string) error + func (w *Writer) Write(b []byte) (int, error)