filewatch

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Errors  = " Errors"
	Matched = " Matched"
)

Variables

View Source
var (
	ErrInvalidRegexp = fmt.Errorf("invalid regexp")
	ErrIgnoredLog    = fmt.Errorf("the requested path is internally ignored")
)

Functions

This section is empty.

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

Action contains the exported methods for this package.

func New

func New(config *common.Config, files []*WatchFile, ignored []string) *Action

New configures the library.

func (*Action) AddFileWatcher

func (a *Action) AddFileWatcher(file *WatchFile) error

func (*Action) Files

func (a *Action) Files() []*WatchFile

Files returns the list of files configured.

func (*Action) Run

func (a *Action) Run()

Run compiles any regexp's and opens a tail -f on provided watch files.

func (*Action) Stop

func (a *Action) Stop()

Stop all file watcher routines.

type Match

type Match struct {
	File    string   `json:"file"`
	Matches []string `json:"matches"`
	Line    string   `json:"line"`
}

Match is what we send to the website.

type WatchFile

type WatchFile struct {
	Path      string `json:"path" toml:"path" xml:"path" yaml:"path"`
	Regexp    string `json:"regex" toml:"regex" xml:"regex" yaml:"regex"`
	Skip      string `json:"skip" toml:"skip" xml:"skip" yaml:"skip"`
	Poll      bool   `json:"poll" toml:"poll" xml:"poll" yaml:"poll"`
	Pipe      bool   `json:"pipe" toml:"pipe" xml:"pipe" yaml:"pipe"`
	MustExist bool   `json:"mustExist" toml:"must_exist" xml:"must_exist" yaml:"mustExist"`
	LogMatch  bool   `json:"logMatch" toml:"log_match" xml:"log_match" yaml:"logMatch"`
	// contains filtered or unexported fields
}

WatchFile is the input data needed to watch files.

func (*WatchFile) Active

func (w *WatchFile) Active() bool

Active returns true if the tail channel is still open.

func (*WatchFile) Stop

func (w *WatchFile) Stop() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL