Last active
November 6, 2016 02:49
-
-
Save joaolucasl/3977e257d7d02882812670bb455b6eb5 to your computer and use it in GitHub Desktop.
Go lang tail and print to terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/hpcloud/tail" | |
) | |
func main() { | |
t, _ := tail.TailFile("/var/log/syslog", tail.Config{Follow: true}) | |
for line := range t.Lines { | |
fmt.Println(line.Text) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment