12 #define Assert(p) ((void)0) 16 #define Assert(e) ((e) ? (void)0 : __Assert(__FILE__, __LINE__, #e)) 18 #define Assert(e) ((e) ? (void)0 : __Assert(__FILE__, __LINE__, "e")) 25 inline void __Assert(
const char * file,
int line,
const char * e)
27 LOG4CXX_FATAL(KrisLibrary::logger(),
"Assertion \""<<e<<
"\" failed: file \""<<file<<
"\", line "<<line);
38 #define __Assert __assert 42 inline void RaiseErrorFmt(
const char* func,
const char* file,
int line,
const char* fmt, ...)
44 LOG4CXX_ERROR(KrisLibrary::logger(),
"Error in "<< func<<
" ("<<file<<
":"<<line);
48 vsnprintf(buf, 1024, fmt, args);
50 LOG4CXX_FATAL(KrisLibrary::logger(),buf);
54 inline void RaiseErrorFmt(
const char* fmt,...)
56 LOG4CXX_ERROR(KrisLibrary::logger(),
"Error (unknown function): ");
60 vsnprintf(buf, 1024, fmt, args);
62 LOG4CXX_FATAL(KrisLibrary::logger(),buf);
67 inline void RaiseError(
const char* func,
const char* file,
int line,
const char* text)
69 LOG4CXX_FATAL(KrisLibrary::logger(),
"Error in "<< func<<
" ("<<file<<
":"<<line<<
"): "<<text);
78 #ifdef HAVE_PRETTY_FUNCTION 79 #define WHERE_AM_I __PRETTY_FUNCTION__, __FILE__, __LINE__ 81 #define WHERE_AM_I __FUNCTION__, __FILE__, __LINE__ 85 #define FatalError1(text) RaiseError(WHERE_AM_I,text) 87 #if HAVE_VARARGS_MACROS 88 #define FatalError(fmt,...) RaiseErrorFmt(WHERE_AM_I,fmt,__VA_ARGS__) 91 #define FatalError RaiseErrorFmt 94 #define PrintLocation(file) fprintf(file,"%s (%s:%d): ", WHERE_AM_I) 95 #define AssertNotReached() RaiseError(WHERE_AM_I,"Code should not be reached") The logging system used in KrisLibrary.