ac5972aca8
Calling watcher.Remove() from the run() goroutine is now problematic, because with the change made in fsnotify/fsnotify#73 Remove() can now take an arbitrary amount of time, which means we can deadlock if run() is waiting for fsnotify to acknowledge the removal and fsnotify is trying to send an unrelated Event. So instead we now do part of the cleanup, including calling Remove(), synchronously, in the goroutine trying to unsubscribe. This fixes #75. Thanks to Aaron Beitch for the fix. Change-Id: I346c9eecc34b2378312b07b3c3efc41616b95380 |
||
---|---|---|
Godeps | ||
cmd/gotail | ||
ratelimiter | ||
util | ||
vendor/gopkg.in | ||
watch | ||
winfile | ||
.gitignore | ||
.travis.yml | ||
CHANGES.md | ||
Dockerfile | ||
LICENSE.txt | ||
Makefile | ||
README.md | ||
tail.go | ||
tail_posix.go | ||
tail_test.go | ||
tail_windows.go |
README.md
Go package for tail-ing files
A Go package striving to emulate the features of the BSD tail
program.
t, err := tail.TailFile("/var/log/nginx.log", tail.Config{Follow: true})
for line := range t.Lines {
fmt.Println(line.Text)
}
See API documentation.
Log rotation
Tail comes with full support for truncation/move detection as it is designed to work with log rotation tools.
Installing
go get github.com/hpcloud/tail/...
Windows support
This package needs assistance for full Windows support.