github.com/dayvar14/tail@v0.0.0-20240222011302-f530c4fa0c9f/README.md (about) 1 [![Go Reference](https://pkg.go.dev/badge/github.com/nxadm/tail.svg)](https://pkg.go.dev/github.com/nxadm/tail#section-documentation) 2 ![ci](https://github.com/nxadm/tail/workflows/ci/badge.svg) 3 [![FreeBSD](https://api.cirrus-ci.com/github/nxadm/tail.svg)](https://cirrus-ci.com/github/nxadm/tail) 4 # tail functionality in Go 5 6 nxadm/tail provides a Go library that emulates the features of the BSD `tail` 7 program. The library comes with full support for truncation/move detection as 8 it is designed to work with log rotation tools. The library works on all 9 operating systems supported by Go, including POSIX systems like Linux, *BSD, 10 MacOS, and MS Windows. Go 1.12 is the oldest compiler release supported. 11 12 A simple example: 13 14 ```Go 15 // Create a tail 16 t, err := tail.TailFile( 17 "/var/log/nginx.log", tail.Config{Follow: true, ReOpen: true}) 18 if err != nil { 19 panic(err) 20 } 21 22 // Print the text of each received line 23 for line := range t.Lines { 24 fmt.Println(line.Text) 25 } 26 ``` 27 28 See [API documentation](https://pkg.go.dev/github.com/nxadm/tail#section-documentation). 29 30 ## Installing 31 32 go get github.com/nxadm/tail/... 33 34 ## History 35 36 This project is an active, drop-in replacement for the 37 [abandoned](https://en.wikipedia.org/wiki/HPE_Helion) Go tail library at 38 [hpcloud](https://github.com/hpcloud/tail). Next to 39 [addressing open issues/PRs of the original project](https://github.com/nxadm/tail/issues/6), 40 nxadm/tail continues the development by keeping up to date with the Go toolchain 41 (e.g. go modules) and dependencies, completing the documentation, adding features 42 and fixing bugs. 43 44 ## Examples 45 Examples, e.g. used to debug an issue, are kept in the [examples directory](/examples).