Skip to content

Commit

Permalink
start working on tail's readme/example
Browse files Browse the repository at this point in the history
  • Loading branch information
Sridhar Ratnakumar committed Oct 12, 2012
1 parent 74f8401 commit f7193d4
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions cmd/tail/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tail
4 changes: 4 additions & 0 deletions cmd/tail/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default: tail

tail: *.go
GOPATH=~/as/logyard go build
18 changes: 18 additions & 0 deletions cmd/tail/main.go
Original file line number Diff line number Diff line change
@@ -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)
}
}

0 comments on commit f7193d4

Please sign in to comment.