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