You move from scattered printfs to a small structured logging framework with a few key properties. Log levels (ERROR, WARN, INFO, DEBUG, etc.) let you classify messages by importance and control verbosity at runtime or build time. Compile-time level gating is essential for embedded: wrap log calls in macros guarded by the configured level so that, in a release build, DEBUG and lower-priority logs compile out entirely, costing zero flash, zero cycles, and zero bandwidth, using the preprocessor (#if) so there's no runtime check and no leftover strings bloating the image or leaking internal info. Timestamps and module/tag prefixes (e.g., [1234ms][UART] rx overflow) let you order events across concurrent tasks and identify the source, which is critical for diagnosing field issues from a log dump. You make the logging non-blocking and deferred so it doesn't perturb timing (enqueue and flush in the background), choose an efficient transport (RTT/UART), and avoid expensive float formatting unless needed (it bloats flash). You also handle buffer overflow deliberately, drop-versus-block policy and a dropped-message counter so gaps are visible. The result is logging you can dial up for debugging and down for release, that has bounded cost, that's safe to call from normal code, and that produces field-diagnosable output, versus ad-hoc prints that bloat the release, perturb timing, and can't be controlled. Many ecosystems provide such frameworks, but the principles (levels, compile-time gating, timestamps/tags, deferred non-blocking output, bounded buffers) are what matter.
Debugging & Toolchain · Interview question
How do you make logging suitable for a shipping product rather than ad-hoc prints?
A strong answer
What a weak answer sounds like
You know the answer. Do you know what gets you dinged?
Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.
From the lesson
printf Debugging & Logging
Where does printf go on a chip with no console, and what does it cost? Retargeting output to UART/SWO/RTT (vs slow halting semihosting), intrusiveness, and leveled, deferred, compile-gated logging.