3 ms·
I prefer printf because it works pretty much anywhere, handles concurrency by default (as in you can see the interleavings, though the log call itself is locked
by slaymaker1907 5y ago
I prefer printf because it works pretty much anywhere, handles concurrency by default (as in you can see the interleavings, though the log call itself is locked), and allows me to have a custom tailored view of the state I want to see.
The last point may not be obvious, but debuggers have tons of noise for complex programs. In practice I just want to see how my program state changes over time while a debugger shows the entire program state or a large subset of it.
I think the future of debugging is going to be structured program state logging. Ideally we should be able to take our logs and partially reconstruct program state over time. For example, in addition to source location, we should save the lexical information for each variable logged so you can have interactivity with your logs and source code.