24 lines
314 B
Go
24 lines
314 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hpcloud/tail"
|
|
)
|
|
|
|
func main() {
|
|
|
|
// https://godoc.org/github.com/hpcloud/tail#Config
|
|
t, err := tail.TailFile(
|
|
"/var/log/nginx.log",
|
|
tail.Config{
|
|
Follow: true,
|
|
})
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
}
|
|
for line := range t.Lines {
|
|
fmt.Println(line.Text)
|
|
}
|
|
}
|