diff --git a/include/sta/debug_serial.hpp b/include/sta/debug_serial.hpp index 8bf151e..90e4053 100644 --- a/include/sta/debug_serial.hpp +++ b/include/sta/debug_serial.hpp @@ -3,9 +3,9 @@ * * Configuration: * STA_DEBUG_SERIAL_ENABLE: Enable module - * STA_DEBUG_SERIAL_DISABLE: Forces module off when defined - * DEBUG: Automatically enables module when defined - * NDEBUG: Forces module off when defined + * STA_DEBUG_SERIAL_FORCE: Ignore debug defines and always enable output + * DEBUG: Enables output when defined + * NDEBUG: Disables output when defined (overrides DEBUG) * * The `sta::DebugSerial` instance must be provided. * NOTE: Include this header before the definition because @@ -17,17 +17,15 @@ #include -#ifdef DEBUG -# ifndef STA_DEBUG_SERIAL_ENABLE -# define STA_DEBUG_SERIAL_ENABLE -# endif // !STA_DEBUG_SERIAL_ENABLE -#endif // DEBUG - -#if defined(NDEBUG) || defined(STA_DEBUG_SERIAL_DISABLE) -# ifdef STA_DEBUG_SERIAL_ENABLE -# undef STA_DEBUG_SERIAL_ENABLE -# endif // STA_DEBUG_SERIAL_ENABLE -#endif // NDEBUG || STA_DEBUG_SERIAL_DISABLE +// Check only if STA_DEBUG_SERIAL_FORCE is not defined +#ifndef STA_DEBUG_SERIAL_FORCE +// Disable module if NDEBUG is defined or DEBUG is not +# if defined(NDEBUG) || !defined(DEBUG) +# ifdef STA_DEBUG_SERIAL_ENABLE +# undef STA_DEBUG_SERIAL_ENABLE +# endif // STA_DEBUG_SERIAL_ENABLE +# endif // NDEBUG || !DEBUG +#endif // !STA_DEBUG_SERIAL_FORCE #ifdef STA_DEBUG_SERIAL_ENABLE