tail v1.1.1 Tail View Source
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)
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Handles :kill call. Checks for any final lines before stopping the genserver
Main loop. Calls check_for_lines, sleeps, then continues the loop by casting :check to self and returning with the (possibly updated) last_modified and position
Init callback. Starts the check loop by casting :check to self and then returns the initial state
Public interface. Starts a Tail Genserver for the given file, function, and interval (in ms)
Public interface. Sends a call to kill the GenServer
Link to this section Types
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Handles :kill call. Checks for any final lines before stopping the genserver
Main loop. Calls check_for_lines, sleeps, then continues the loop by casting :check to self and returning with the (possibly updated) last_modified and position
Init callback. Starts the check loop by casting :check to self and then returns the initial state
start_link(file, fun, interval \\ 1000)
View Sourcestart_link(String.t(), ([String.t()] -> nil), integer()) :: GenServer.on_start()
Public interface. Starts a Tail Genserver for the given file, function, and interval (in ms)
Public interface. Sends a call to kill the GenServer