Skip to content

chmike/tail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tail

GitHub Release Go Reference go.mod Build Status Go Report Card Codecov

A go module/package to read all lines appended to a file at runtime. It support file rotation which is a common practice for log files. It currently works on Linux and MacOS, not on Windows.

import "github.com/chmike/tail"

func main() {
  tail := NewTail("/var/log/auth.log")
  for {
    select {
      case line := <-tail.Line:
        println(line)
      case err := <-tail.Error:
        print("error:")
        println(err.Error())
        break
    }
  }
}