# Managing Serial.print() as a debug tool

**URL:** <https://forum.arduino.cc/t/managing-serial-print-as-a-debug-tool/1024824>\
**Category:** Programming\
**Created:** [August 23, 2022, 8:03am UTC](https://forum.arduino.cc/t/managing-serial-print-as-a-debug-tool/1024824 "2022-08-23T08:03:43Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [August 23, 2022, 8:06am UTC](https://forum.arduino.cc/t/managing-serial-print-as-a-debug-tool/1024824/2 "2022-08-23T08:06:28Z")

</div>

I use this

```cpp
#define DEBUG 1 // SET TO 0 OUT TO REMOVE TRACES

#if DEBUG
#define D_SerialBegin(...) Serial.begin( __VA_ARGS__ );
#define D_print(...) Serial.print( __VA_ARGS__ )
#define D_write(...) Serial.write( __VA_ARGS__ )
#define D_println(...) Serial.println( __VA_ARGS__ )
#else
#define D_SerialBegin(...)
#define D_print(...)
#define D_write(...)
#define D_println(...)
#endif
 

```

That takes care of the multiple versions of print

---

_[View the full topic](https://forum.arduino.cc/t/managing-serial-print-as-a-debug-tool/1024824)._
