▲ | lordnacho 6 days ago | ||||||||||||||||||||||||||||||||||||||||||||||||||||
> Meanwhile many of the seniors around me are stuck in their ways, refusing to adopt interactive debuggers to replace their printf() debug habits, let alone AI tooling... When I was new to the business, I used interactive debugging a lot. The more experienced I got, the less I used it. printf() is surprisingly useful, especially if you upgrade it a little bit to a log-level aware framework. Then you can leave your debugging lines in the code and switch it on or off with loglevel = TRACE or INFO, something like that. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | shmerl 6 days ago | parent | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
I kind of had the opposite experience. I used to rely mostly on printfs and etc. but started using debugger more. printf doesn't improve going up and down the call stacks in the debugger to analyze their chain (you'd have to spam debug printfs all around you expect this chain to happen to replace the debugger which would waste time). debugger is really powerful if you use it more than superficially. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | ambicapter 6 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
> printf() is surprisingly useful, especially if you upgrade it a little bit to a log-level aware framework. What do you mean by this? Do you mean using a logging framework instead of printf()? | |||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | cbanek 6 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
This is absolutely true. If anything, interactive debuggers are a crutch and actual logging is the real way of debugging. You really can't debug all sorts of things in an interactive debugger, things like timing issues, thread problems, and you certainly can't find the actual hard bugs that are in running services in production, you know, where the bugs actually happen and are found. Or on other people's machines that you can't just attach a debugger. You need good logging with a good logging library that doesn't affect performance too much when it's turned off, and those messages can also provide very useful context to what things are going on, many times as good if not better than a comment, because at least the log messages are compiled in and type checked, as opposed to comments, which can easily go stale. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | evertedsphere 5 days ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
it can get even better https://rustc-dev-guide.rust-lang.org/tracing.html#i-dont-wa... |