FS Sync

Monitors file system events using [fs\_event]( and recompiles .erl files on the fly using compile:file/2, reloads beam files by code:load\_binary/3.


fs_sync:go/0 tries to guess project root (e.g. goes two level up from _rel folder).

fs_tracer:add(Module, Function).
fs_tracer:del(Module, Function).

Enables tracing for specific functions. Tracing is enabled on all processes.

Sample output:
(fs_sync@> fs_tracer:go().
(fs_sync@> fs_tracer:add(lists, seq).
(fs_sync@> spawn(fun() -> X = lists:seq(1,5) end).
TRACE: lists:seq/2 <- [1,5]
TRACE: lists:seq/2 -> [1,2,3,4,5]

Please note that when module is reloaded (e.g. with fs_sync), then tracing is resetted.

Tracer formatter

To process trace arguments (think of huge erlang structs) one can use a formatter function:
fs_tracer:formatter(fun(X) -> X end).

This function will be applied to each function argument one by one, and to function result.
There is a built-in formatter to hide records by their names:
fs_tracer:formatter(fun tracer_fmt:hide_records/1).

External handlers

File type is determined by file extension. Natively handled types are "erl" and "beam". It is possible to define
an external type handler for unknown file types as **default\_handler** parameter (script will be executed in erlang node cwd),
and an external handler to execute after internal handler -- **after\_handler** parameter.
External handlers are called with Erlang os:cmd/1, with type and filename provided as command line arguments, see 

Configuration options

Complete documented configuration file [sys.config](rel/sys.config).

* **skip\_types** -- list of file extensions to ignore completely
* **synthesize\_beam\_event** -- a helper for naive fs_event scanner, to reload beam file immediately after compilation
* **after_handler**  -- see External handlers
* **default_handler** -- see External handlers

Future plans

1. Integrate with fs_sync (e.g. re-apply tracing on module reload)
2. Maybe handle .hrl changes as well, a-la @choptastics sync
3. Have examples for external tools (rebar, namely)