start working on tail's readme/example
This commit is contained in:
parent
74f84016b8
commit
f7193d4658
|
@ -0,0 +1,18 @@
|
|||
# Tail implementation in Go
|
||||
|
||||
A Go package striving to emulate the BSD `tail` program.
|
||||
|
||||
```Go
|
||||
t := tail.TailFile("/var/log/nginx.log", 1000, true, true)
|
||||
for line := range t.Lines {
|
||||
fmt.Println(line.Text)
|
||||
}
|
||||
```
|
||||
|
||||
## TODO
|
||||
|
||||
* tests
|
||||
* command line program (`tail -f ...`)
|
||||
* refactor: use Config? `NewTail(tail.Config{Filename: "", Follow: tail.FOLLOW_NAME})`
|
||||
* refactor: get rid of 'end' flag; allow `-n <number>` with `-n -1`
|
||||
for end.
|
|
@ -0,0 +1 @@
|
|||
tail
|
|
@ -0,0 +1,4 @@
|
|||
default: tail
|
||||
|
||||
tail: *.go
|
||||
GOPATH=~/as/logyard go build
|
|
@ -0,0 +1,18 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"logyard/tail"
|
||||
)
|
||||
|
||||
var samplefile = "/Users/sridharr/Library/Logs/PyPM/1.3/PyPM.log"
|
||||
|
||||
func main() {
|
||||
t, err := tail.TailFile(samplefile, 1000, true, true)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for line := range t.Lines {
|
||||
fmt.Println(line.Text)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue