Tail

Tail implements a simple file tail functionality.

Given a file, a function, and an interval, Tail will execute the function with a list of new lines found in the file and continue checking for additional lines on the interval.

Usage

{:ok, pid} = Tail.start_link(“test.txt”, &IO.inspect(&1), 1000) Tail.stop(pid)

Source

Summary

start_link(file, fun, interval \\ 1000)

Public interface. Starts a Tail Genserver for the given file, function, and interval (in ms)

stop(pid)

Public interface. Sends a call to kill the GenServer

Types

state :: {term, ([String.t] -> nil), Integer, any, Integer}

Functions

start_link(file, fun, interval \\ 1000)

Specs:

Public interface. Starts a Tail Genserver for the given file, function, and interval (in ms)

Source
stop(pid)

Specs:

  • stop(pid) :: :ok

Public interface. Sends a call to kill the GenServer

Source