Tap

Summary

Traces calls, return values and exceptions from the function call template given as an argument

Traces on the function patterns given as an argument

Functions

calls(tspecs, opts)

Traces on the function patterns given as an argument.

Examples

Trace calls (but not return values) to &String.strip with any number of arguments and print the first ten events:

iex> Tap.calls([{String, :strip, :_}], max: 10)
2

Trace calls and return values from &String.strip/2 and print the first ten events:

iex> Tap.calls([{String, :strip, {2, :return}}], max: 10)
2
format(event)
format(arg, message)

Macros

call(mfa, opts)

Traces calls, return values and exceptions from the function call template given as an argument.

Examples

Trace calls to &String.starts_with?/2 and print the first two events:

iex> Tap.call(String.starts_with?(_, _), 2)
1

Trace calls to &String.starts_with?/2 when the second argument is "b" and print the first event:

iex> Tap.call(String.starts_with?(_, "b"), 1)
1