What's the recommended process for debugging the code execution through an external package in Elixir? Is it possible to add logs there? #elixirlang
@pepicrft not sure what do you mean, but you can totally attach to a node and then observe the execution with pretty much anything, from :sys to full-blown observer.
@jonn let’s say I have an external package, and I’d like to stop the execution in a line of that package and step through the execution to see variables’ values. How would you do it?
@pepicrft oh, there's also one rather funky way! Rewrite your mix.exs to point to a dependency via filesystem. For example, a `plug` dependency shall become:
```
{:plug, path: "deps/plug"},
```
Now you can insert some hack like IEx.pry[1] straight into your dependency where you want it and `mix compile` shall automatically recompile it. Now it's suffice to run the code in `iex` and you'll get dropped into the breakpoints.
I think that this is the most Elixir way to do it, to be honest, but I'd still check if you're solving XY problem before trying. Static code analysis and tracing are way more impactful while trying to understand what's going on in a BEAM system than step-by-step debugging.
@jonn thanks for the tips John. I’m new to the ecosystem so I have a lot to learn yet. I found documentation to be quite good, but you often wonder what’s the conventional way for doing X and that’s not documented.