1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| #ifndef DEBUG_MACRO_HPP // garde anti inclusion multiple
#define DEBUG_MACRO_HPP
#ifdef DEBUG // si le symbole DEBUG est defini
#include <consolelogger.hpp>
#include <cassert>
#define DEBUGACTION(x1,x2) \
ConsoleLogger::instance().logAction( x1 , x2 ,__FILE__,__LINE);
#define DEBUGEVENT(x1)\
ConsoleLogger::instance().logEvent( x1,__FILE__,__LINE);
#define DEBUGSUCCESS \
ConsoleLogger::instance().logResult("success","");
#define DEBUGWARNING(x1) \
ConsoleLogger::instance().logResult("warning", x1 );
#define DEBUGERROR( a, x1) \
ConsoleLogger::instance().logResult("error", x1 ); \
assert(a);
#else //si DEBUG n'est pas défini, on transforme tout en "no op"
#define DEBUGACTION(x1,x2) ;
#define DEBUGEVENT(x1) ;
#define DEBUGSUCCESS ;
#define DEBUGWARNING(x1) ;
#define DEBUGERROR(x1) ;
#endif // symbole DEBUG
#endif //DEBUG_MACRO_HPP |
Partager