This commit is contained in:
2019-12-16 21:39:57 +00:00
parent aef592a235
commit f74f153569
4 changed files with 41 additions and 1 deletions
+23
View File
@@ -0,0 +1,23 @@
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)
}
}