2013-02-05 10:59:04 +08:00
|
|
|
# Go package for tail-ing files
|
2012-10-13 00:05:11 +08:00
|
|
|
|
2013-02-05 10:59:04 +08:00
|
|
|
A Go package striving to emulate the features of the BSD `tail` program.
|
2012-10-13 00:05:11 +08:00
|
|
|
|
|
|
|
```Go
|
2013-02-06 10:49:32 +08:00
|
|
|
t, err := tail.TailFile("/var/log/nginx.log", tail.Config{Follow: true})
|
2012-10-13 00:05:11 +08:00
|
|
|
for line := range t.Lines {
|
|
|
|
fmt.Println(line.Text)
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2013-01-08 04:51:30 +08:00
|
|
|
## Installing
|
|
|
|
|
|
|
|
go get github.com/ActiveState/tail
|
|
|
|
|
2012-10-18 02:56:54 +08:00
|
|
|
## Building
|
|
|
|
|
|
|
|
To build and test the package,
|
|
|
|
|
|
|
|
make test
|
|
|
|
|
2013-02-05 10:59:04 +08:00
|
|
|
To build the toy command-line program `gotail`,
|
2012-10-18 02:56:54 +08:00
|
|
|
|
|
|
|
cd cmd/gotail
|
|
|
|
make
|
|
|
|
./gotail -h
|
|
|
|
|
2012-10-13 00:05:11 +08:00
|
|
|
## TODO
|
|
|
|
|
2012-10-18 02:56:54 +08:00
|
|
|
* Support arbitrary values for `Location`
|
|
|
|
|