TwistingTwists

TwistingTwists

Approach to development in Elixir - Utilising Elixir tools better

This is a general discussion for how to use Elixir tooling better for development. (OTP or Phoenix projects)

Currently, I and my friend use IO.inspect everywhere in our app to debug what is not working.
We have a nice ColorIO module which enables us to IO.inspect in different colors. :stuck_out_tongue:

This is one approach to development we learnt while being in JS and Python ecosystem. Just log everything to terminal.

  1. What are other ways people develop / debug their apps?
  2. Are there some good Elixir tools for debugging?
  3. Any other questions that people want to discuss, I will put them here after editing.

Thanks!

(since Elixir 1.13 mentions a lot of tooling and behind the scenes changes, I wonder if I am yet unaware of some awesome tool.)

Most Liked

ruslandoga

ruslandoga

Sometimes tracing is more informative than manual IO.inspect

In tests I start tracing before the failing function is called:

test "some curious failure" do
  Rexbug.start("Schrodingbug :: return", msgs: 30)
  refute Schrodingbug.maybe_fail()
end

In dev I can run it before execution some function in UI / API request, like before logging in:

iex> Rexbug.start("Accounts :: return", msgs: 100, time: 10000)

# ... starts printing out traces of the function executed in the login flow
# ... gives a better understanding of how things fit together

Best of all it works in prod, but that use-case is already described in the project descriptions above.

Last Post!

Sebb

Sebb

It is. If you look into tracing, give the Rexbug print_fun option a try: print_fun

Custom function to use to print the trace messages.

So you have full control. You could eg color the trace for starters.

Where Next?

Popular in Discussions Top

AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31771 143
New
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
Fl4m3Ph03n1x
Background A few days ago I was listening to The future of Elixir from Elixir Talks, with Dave Thomas (@pragdave ) and Brian Mitchell. I...
New
mikl
I wanted to capitalize a string, and tried using String.capitalize(). That generally works well, until you try to capitalize a word like...
New
matthias_toepp
I’d love to hear what people think about Wisp, the new Gleam web framework started by Gleam’s primary creator Louis Pilfold. Gleam, alon...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

Other popular topics Top

vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

We're in Beta

About us Mission Statement