README.md

<img src="./etc/assets/logo_do_trace_sq.png" width="100" height="100">

# DoTrace

Provides a `trace/1` macro to trace function calls at runtime, mimicking [Clojure's `dotrace` output](https://www.cs.utexas.edu/~novak/tracing.html).

A response to a [LinkedIn post](https://www.linkedin.com/posts/michael-drogalis_can-your-programming-language-do-this-this-activity-7369742368205365251-SKGJ).

## Example usage

```elixir
iex> defmodule Math do
       def factorial(0), do: 1
       def factorial(n) when n > 0, do: n * factorial(n - 1)
     end
iex> require DoTrace
iex> DoTrace.trace(Math.factorial(5))
TRACE t1028: (factorial [5])
TRACE t1092: | (factorial [4])
TRACE t1156: | | (factorial [3])
TRACE t1220: | | | (factorial [2])
TRACE t1284: | | | | (factorial [1])
TRACE t1348: | | | | | (factorial [0])
TRACE t1348: | | | | | | => 1
TRACE t1284: | | | | | => 1
TRACE t1220: | | | | => 2
TRACE t1156: | | | => 6
TRACE t1092: | | => 24
TRACE t1028: | => 120
120
```

## Installation

Add [`do_trace`](https://hex.pm/packages/do_trace) to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [
    {:do_trace, "~> 0.1.0"}
  ]
end
```

## License

[BSD 3-Clause](https://opensource.org/license/bsd-3-clause)

## Documentation

https://hexdocs.pm/do_trace.