go-tail

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2020 License: MIT Imports: 5 Imported by: 0

README

go-tail

A go package for tailing files. go get -u github.com/papertrail/go-tail

Usage

File reading follower
package main

import (
	"io"
	"fmt"
	"os"

	"github.com/papertrail/go-tail/follower"
)

func main() {
	t, err := follower.New("yourlogfile.log", follower.Config{
		Whence: io.SeekEnd,
		Offset: 0,
		Reopen: true,
	})

	for line := range t.Lines() {
		fmt.Println(line)
	}

	if t.Err() != nil {
		fmt.FPrintln(os.Stderr, t.Err())
	}
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL