Loopp/src/debug.hxx

36 lines
1.1 KiB
C++
Raw Normal View History

2013-09-11 15:19:38 +02:00
#ifndef LUPPP_DEBUG_HXX
#define LUPPP_DEBUG_HXX
#include <stdio.h>
#include <stdarg.h>
2013-09-17 12:00:12 +02:00
/* Example usage
LUPPP_NOTE( "%s", "MessageHere" );
LUPPP_WARN( "%s", "MessageHere" );
LUPPP_KILL( "%s", "MessageHere" );
*/
2013-09-11 15:19:38 +02:00
enum DEBUG_LEVEL {
DEBUG_LEVEL_NOTE = 0,
DEBUG_LEVEL_WARN,
DEBUG_LEVEL_ERROR,
2013-09-17 12:00:12 +02:00
DEBUG_LEVEL_TEST
2013-09-11 15:19:38 +02:00
};
void luppp_debug( int warnLevel, const char* name, const char* file, const char* func, int line,
const char* format = 0, ... );
2013-09-17 12:00:12 +02:00
2013-09-25 19:21:05 +02:00
#define LUPPP_DSP( format, args... ) luppp_debug( DEBUG_LEVEL_NOTE, " DSP ", "", "", 0, format, ## args )
2013-09-11 15:19:38 +02:00
#define LUPPP_NOTE( format, args... ) luppp_debug( DEBUG_LEVEL_NOTE, NAME, __FILE__, __FUNCTION__, __LINE__, format, ## args )
#define LUPPP_WARN( format, args... ) luppp_debug( DEBUG_LEVEL_WARN, NAME, __FILE__, __FUNCTION__, __LINE__, format, ## args )
#define LUPPP_ERROR( format, args... ) luppp_debug( DEBUG_LEVEL_ERROR, NAME, __FILE__, __FUNCTION__, __LINE__, format, ## args )
2013-09-17 12:00:12 +02:00
// only gets printed if #definde BUILD_TESTS
#define LUPPP_PRINT_TEST( format, args... ) luppp_debug( DEBUG_LEVEL_DEBUG_ONLY, NAME, __FILE__, __FUNCTION__, __LINE__, format, ## args )
2013-09-11 15:19:38 +02:00
#endif