Skip to content

Files

38 lines (26 loc) · 623 Bytes

README.md

File metadata and controls

38 lines (26 loc) · 623 Bytes

filewatch

中文

filewatch is a file harvester, mostly used to fetch logs files and feed them into other components.

Quick start

package main

import (
	"fmt"

	"github.com/ChangSZ/filewatch"
)

func main() {
	watcher := filewatch.NewWatcher()
	watcher.SetCompleteMarker("***")
	watcher.SetFileRegexp(`\d+.log`)
	watcher.SetWatchDir("./logs")
	watcher.SetRemoveAfterComplete(true)

	go func() {
		for info := range watcher.GetResChan() {
			fmt.Printf("%+v\n", info)
		}
	}()
	watcher.Start()
}

Contributions

If you have an issue, found a bug or have a feature request, go ahead!