3 ms·
A debugger will be preferable in situations with: - slow compilation - slow start - lack of serialization - complex algorithms In all other cases I pr
by wruza 3y ago
A debugger will be preferable in situations with:
- slow compilation
- slow start
- lack of serialization
- complex algorithms
In all other cases I prefer debug logging. It’s just easier to scroll through a couple of pages than stepping in/out of functions and managing watches. If you compare my gdb session with my debug logs, in an ideal case they’ll be the same. The only difference is the amount of work I put into writing debug code or driving a debugger.
In general I think that logs and debuggers aren’t enemies. A debugger helps with exploration in a specific moment or catching a specific condition or access. Debug logs help with matching expectations about a whole process. But both can do both.
Also, when I’m writing a service, I always write detailed operation logs. Saves your butt when something “costed us money” happened three days ago and you have to explain why. These never get turned off, regardless.