Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileWatcher ¶
type FileWatcher struct {
// contains filtered or unexported fields
}
FileWatcher watches files and publishes events as they are written to the file.
func NewFileWatcher ¶
func NewFileWatcher( fileConfig indexedfiles.IndexedFileConfig, filename string, hostName string, eventPublisher events.EventPublisher, ctx context.Context, logger *zap.Logger, ) (*FileWatcher, error)
NewFileWatcher returns a FileWatcher which will watch a file and publish events according to the IndexedFileConfig
func (*FileWatcher) Start ¶
func (fw *FileWatcher) Start()
Start begins watching the file according to its IndexedFileConfig
type FileWatcherCommand ¶
type FileWatcherCommand int
FileWatcherCommand is a command that can be sent to a FileWatcher to tell it to perform various actions
const ( // CommandReopen closes the file and opens it again CommandReopen FileWatcherCommand = 1 // CommandReload updates the file watcher's configuration to the new configuration stored in the "newFileConfig" property CommandReloadConfig FileWatcherCommand = 2 )
type GlobWatcher ¶ added in v0.5.0
type GlobWatcher struct { Cancel func() // contains filtered or unexported fields }
GlobWatcher watches a glob pattern to find log files. When a log file is found it will create a FileWatcher to read the file.
func NewGlobWatcher ¶ added in v0.5.0
func NewGlobWatcher( fileConfig indexedfiles.IndexedFileConfig, glob string, hostName string, eventPublisher events.EventPublisher, ctx context.Context, logger *zap.Logger, ) (*GlobWatcher, error)
NewGlobWatcher creates a new watcher. The watcher will find any log files matching the glob pattern and create new FileWatchers for them. The FileWatchers will publish events to the given eventPublisher.
func (*GlobWatcher) UpdateConfig ¶ added in v0.5.0
func (gw *GlobWatcher) UpdateConfig(cfg indexedfiles.IndexedFileConfig)