smart_tracer v0.1.1 SmartTracer View Source

A simple wrapper for recon_trace.

Usage

When connected to a live remote console, issue the trace/2 passing the function reference and rate limit.

Tracing a global function

    iex> SmartTracer.trace(&FakeModule.hello/1, 5)
    1
    iex> FakeModule.hello("Vince")
    Elixir.SmartTracer.Support.FakeModule.hello/1 is being called with:
      ["Vince"]

Tracing a local function

    iex> SmartTracer.trace(&FakeModule.get_name/1, 5, scope: :local)
    1
    iex> FakeModule.hello("Vince")
    Elixir.SmartTracer.Support.FakeModule.get_name/1 is being called with:
      ["Vince"]

Tracing a function and getting it's return value (possiblemix hex also for local tracing)

    iex> SmartTracer.trace(&FakeModulne.hello/1, 5, return: true)
    1
    iex> FakeModule.hello("Vince")
    Elixir.SmartTracer.Support.FakeModule.hello/1 is being called with:
      ["Vince"]
    Elixir.SmartTracer.Support.FakeModule.hello/1 returns:
      "Hello, my name is NAME-Vince"

Link to this section Summary

Functions

Stops tracing any function calls.

Traces calls for the specified function.

Link to this section Functions

Stops tracing any function calls.

Link to this function

trace(function, calls_count, opts \\ [])

View Source
trace(function :: (... -> any()), calls_count :: integer(), opts :: keyword()) ::
  integer()

Traces calls for the specified function.

Options

  • :return - display return value of the specified function, defaults to false
  • :scope - determines wether to trace local calls as well

    • :global (default) - trace only public functions
    • :local - trace private function calls as well