boulder/vendor/github.com/nxadm/tail
Matthew McPherrin 75439eab4b
Replace hpcloud/tail with nxadm/tail (#7152)
The hpcloud version appears abandoned, with numerous unfixed bugs
including ones that can cause it to miss data.  The nxadm fork is
maintained.

The updated tail also pulls in an updated fsnotify. We had it vendored
at two paths before, so this has a side benefit of simplifying us to
having just one copy.
2023-11-09 16:30:15 -08:00
..
ratelimiter Replace hpcloud/tail with nxadm/tail (#7152) 2023-11-09 16:30:15 -08:00
util Replace hpcloud/tail with nxadm/tail (#7152) 2023-11-09 16:30:15 -08:00
watch Replace hpcloud/tail with nxadm/tail (#7152) 2023-11-09 16:30:15 -08:00
winfile Replace hpcloud/tail with nxadm/tail (#7152) 2023-11-09 16:30:15 -08:00
.cirrus.yml Replace hpcloud/tail with nxadm/tail (#7152) 2023-11-09 16:30:15 -08:00
.gitignore Replace hpcloud/tail with nxadm/tail (#7152) 2023-11-09 16:30:15 -08:00
CHANGES.md Replace hpcloud/tail with nxadm/tail (#7152) 2023-11-09 16:30:15 -08:00
CONTRIBUTING.md Replace hpcloud/tail with nxadm/tail (#7152) 2023-11-09 16:30:15 -08:00
Dockerfile Replace hpcloud/tail with nxadm/tail (#7152) 2023-11-09 16:30:15 -08:00
LICENSE Replace hpcloud/tail with nxadm/tail (#7152) 2023-11-09 16:30:15 -08:00
README.md Replace hpcloud/tail with nxadm/tail (#7152) 2023-11-09 16:30:15 -08:00
tail.go Replace hpcloud/tail with nxadm/tail (#7152) 2023-11-09 16:30:15 -08:00
tail_posix.go Replace hpcloud/tail with nxadm/tail (#7152) 2023-11-09 16:30:15 -08:00
tail_windows.go Replace hpcloud/tail with nxadm/tail (#7152) 2023-11-09 16:30:15 -08:00

README.md

Go Reference ci FreeBSD

tail functionality in Go

nxadm/tail provides a Go library that emulates the features of the BSD tail program. The library comes with full support for truncation/move detection as it is designed to work with log rotation tools. The library works on all operating systems supported by Go, including POSIX systems like Linux, *BSD, MacOS, and MS Windows. Go 1.12 is the oldest compiler release supported.

A simple example:

// Create a tail
t, err := tail.TailFile(
	"/var/log/nginx.log", tail.Config{Follow: true, ReOpen: true})
if err != nil {
    panic(err)
}

// Print the text of each received line
for line := range t.Lines {
    fmt.Println(line.Text)
}

See API documentation.

Installing

go get github.com/nxadm/tail/...

History

This project is an active, drop-in replacement for the abandoned Go tail library at hpcloud. Next to addressing open issues/PRs of the original project, nxadm/tail continues the development by keeping up to date with the Go toolchain (e.g. go modules) and dependencies, completing the documentation, adding features and fixing bugs.

Examples

Examples, e.g. used to debug an issue, are kept in the examples directory.