Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = []Option{ WithWaitForFile(true, 0), WithCloseOnDelete(false), }
View Source
var ErrIdleTimeout = fmt.Errorf("idle timeout")
View Source
var ErrWaitTimeout = fmt.Errorf("wait for file timeout")
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(opts *Options)
func WithCloseOnDelete ¶
func WithCloseOnTruncate ¶
func WithIdleTimeout ¶
func WithTimeoutsAsEOF ¶
type Options ¶
type Options struct { // WaitForFile indicates whether the reader should wait for the file to be created // If this is set to false, Read will return an error if the file does not exist. // // This will also cause the reader to wait if the file is deleted at some point // and CloseOnDelete is set to false. WaitForFile bool // WaitForFileTimeout indicates how long the reader should wait for the file to be created // If this is set to 0, the reader will wait indefinitely. WaitForFileTimeout time.Duration // CloseOnDelete indicates whether the reader should be closed if the file is deleted CloseOnDelete bool // CloseOnTruncate indicates whether the reader should be closed if the file is truncated CloseOnTruncate bool // IdleTimeout indicates how long the reader should wait for new data before closing // If this is set to 0, the reader will wait indefinitely IdleTimeout time.Duration // Whether or not .Read() should return io.EOF if the wait for file or idle timeout is reached TreatTimeoutsAsEOF bool }
type TailingReader ¶
type TailingReader struct {
// contains filtered or unexported fields
}
func NewTailingReader ¶
func NewTailingReader(filePath string, options ...Option) (*TailingReader, error)
func (*TailingReader) Close ¶
func (r *TailingReader) Close() error
func (*TailingReader) WaitForFile ¶
func (r *TailingReader) WaitForFile() error
Click to show internal directories.
Click to hide internal directories.