Skip to content
/ ptail Public

Read the file from the end with golang and execute the hook

Notifications You must be signed in to change notification settings

pyama86/ptail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ptail

Read the file from the end with golang and execute the hook

usage

package main

import (
	"fmt"

	"github.com/pyama86/ptail/ptail"
)

func main() {
	p := ptail.NewPtail("/path/to/example.log", 100)
	cnt := 0

	p.Use(func(l []byte) error {
		fmt.Println(string(l))
		return nil
	})

	p.Use(func(l []byte) error {
		cnt++
		return nil
	})

	p.Execute()
	fmt.Println(cnt)
}

Middleware Function

type middlewareFunc func([]byte) error

author

@pyama86

About

Read the file from the end with golang and execute the hook

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages