Today I Learned

A Hashrocket project

Looking at the state of processes in Elixir

When debugging gen_server, gen_statem and gen_event processes it can be helpful to take a look at the state.

Its easy to do this in Elixir by calling out to Erlangs sys.get_state/1:

iex(1)> defmodule Example, do: use GenServer
iex(2)> {:ok, pid} = GenServer.start_link(Example, %{ping: "pong"})
iex(3)> :sys.get_state(pid)
%{ping: "pong"}

For more common sys debugging functions, take a look here

Looking for help? Elixir is quickly gaining momentum for web applications that need concurrency, performance, and the ability to connect to many different clients. The developers at Hashrocket are learning along with the rest of the development community that Elixir and Phoenix are viable Rails alternatives for the right application. Check out the source code for Today I Learned, written in Elixir, and contact us if you need help with your Elixir project.