-Added Debug class
This commit is contained in:
parent
1685bafdb2
commit
27532b3fa4
4 changed files with 73 additions and 0 deletions
|
@ -2,6 +2,9 @@
|
|||
#ifndef LUPPP_CONFIG_H
|
||||
#define LUPPP_CONFIG_H
|
||||
|
||||
/// PROGAM WIDE DEFINES
|
||||
#define NAME "Luppp"
|
||||
|
||||
/// TEST OPTIONS
|
||||
#define BUILD_TESTS 1
|
||||
|
||||
|
@ -23,6 +26,10 @@
|
|||
#define DEBUG_STATE 1
|
||||
|
||||
|
||||
/// COMPILE OPTIONS
|
||||
#define DEBUG_KILL_ON_ERR 1
|
||||
|
||||
|
||||
/// General Options
|
||||
#define NTRACKS 8
|
||||
#define NSCENES 10
|
||||
|
@ -30,5 +37,9 @@
|
|||
// nsamples remaining during recording before Looper requests larger buffer
|
||||
#define LOOPER_SAMPLES_BEFORE_REQUEST 44100
|
||||
|
||||
|
||||
/// include debug.hxx for printing convienience
|
||||
#include "debug.hxx"
|
||||
|
||||
#endif // LUPPP_CONFIG_H
|
||||
|
||||
|
|
35
src/debug.cxx
Normal file
35
src/debug.cxx
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
#include "debug.hxx"
|
||||
#include "config.hxx"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
void luppp_debug( int warnLevel, const char* name, const char* file, const char* func, int line,
|
||||
const char* format, ... )
|
||||
{
|
||||
if ( warnLevel == DEBUG_LEVEL_KILL )
|
||||
{
|
||||
printf( "[\033[1;31m%s\033[0m] %s : %s : %i ", NAME, file, func, line );
|
||||
#ifdef DEBUG_KILL_ON_ERR
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
else if ( warnLevel == DEBUG_LEVEL_WARN )
|
||||
{
|
||||
printf( "[\033[1;33m%s\033[0m] %s : %s : %i ", NAME, file, func, line );
|
||||
}
|
||||
else // NOTE
|
||||
{
|
||||
printf( "[\033[1;32m%s\033[0m] %s : %s : %i ", NAME, file, func, line );
|
||||
}
|
||||
|
||||
if ( format )
|
||||
{
|
||||
va_list args;
|
||||
va_start( args, format );
|
||||
printf( format, args );
|
||||
va_end( args );
|
||||
}
|
||||
printf( "\033[0m\n" );
|
||||
}
|
||||
|
22
src/debug.hxx
Normal file
22
src/debug.hxx
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
#ifndef LUPPP_DEBUG_HXX
|
||||
#define LUPPP_DEBUG_HXX
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
enum DEBUG_LEVEL {
|
||||
DEBUG_LEVEL_NOTE = 0,
|
||||
DEBUG_LEVEL_WARN,
|
||||
DEBUG_LEVEL_KILL
|
||||
};
|
||||
|
||||
void luppp_debug( int warnLevel, const char* name, const char* file, const char* func, int line,
|
||||
const char* format = 0, ... );
|
||||
|
||||
#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_KILL( format, args... ) luppp_debug( DEBUG_LEVEL_KILL, NAME, __FILE__, __FUNCTION__, __LINE__, format, ## args )
|
||||
|
||||
#endif
|
||||
|
|
@ -23,6 +23,11 @@ const char* GridLogic::StateString[8] = {
|
|||
|
||||
GridLogic::GridLogic()
|
||||
{
|
||||
LUPPP_NOTE( "%s", "GridLogic() note" );
|
||||
LUPPP_WARN( "%s", "GridLogic() warn" );
|
||||
LUPPP_KILL( "%s", "GridLogic() kill" );
|
||||
//luppp_debug( "GridLogic", __FILE__, __LINE__ );
|
||||
//luppp_debug( "GridLogic", __FILE__, __LINE__, "%s", "Starting up..." );
|
||||
sceneLaunch = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue