smart_tracer v0.2.1 SmartTracer.Custom behaviour View Source

With SmartTracer, you can also specify how you would want to present the traces.

Here's an example.

  defmodule SmartTracer.Examples.CustomTracer do
    use SmartTracer.Custom

    def handle(:call, {module, fun, args}) do
      IO.puts("#{module}.#{fun}/#{length(args)} was called with #{inspect(args)}")
    end

    def handle(:return, {module, fun, arity, return_value}) do
      IO.puts("#{module}.#{fun}/#{arity} returned: #{inspect(return_value)}")
    end
  end

Link to this section Summary

Link to this section Callbacks

Link to this callback

handle(atom, {})

View Source
handle(
  :call,
  {module :: module(), function :: (... -> any()), args :: [term()]}
) :: any()
handle(
  :return,
  {module :: module(), function :: (... -> any()), args :: [term()],
   return_value :: any()}
) :: any()