How to convert a pid string from logs into pid values?

Background

I have finally been able to log processes receiving a specific message. This log has the following format:

(<0.1715.0>) << {#Ref<0.4085106555.3863478275.76112>,badarg}
(<0.1753.0>) << {#Ref<0.4085106555.3863216133.166138>,badarg}

Where <0.1753.0> is the pid.

Question

Now I want to use Process.info on the pid but I don’t know how to transform the <0.1753.0> string into a pid I can use.

Is there any iex helper to convert the <0.1753.0> string into a pid value I can use with Process.info?

iex(1)> pid("0.1753.0") 
#PID<0.1753.0>

or

iex(3)> pid(0, 1753, 0)
#PID<0.1753.0>

It comes from IEx.Helpers https://hexdocs.pm/iex/IEx.Helpers.html#pid/1

6 Likes

There’s also :erlang.list_to_pid, which can convert a charlist to a pid. But be aware of the big warning in its documentation, that it’s only meant for debugging.

3 Likes