Frustrating debugging abilities

I am unable to see the details required to determine where calculations go wrong within the code in scripts so it’s taking forever to write any decent code! For example where can I actually step through the execution of the code to validate the values of variables? As the next best step, what about logging values while they are in the middle of formulas in template code? Any useful logging integrations that can help at least? This is like driving blind. The debugger tells me a script had to stop because a value was invalid. Which part of the equation? Which variable within the equation? What were all the values of all of those variables inside the formula at that point in time? It takes hours and hours and hours of trial and error writing and rewriting tiny pieces of code via trial and error to get it to work! How can I put logging statements all over the place that I can remove later? Doesn’t anyone else sense the same frustration at this?