41 #include <lifev/core/util/LifeAssertSmart.hpp> 48 #if (defined _MSC_VER) || (defined __BORLANDC__) 50 #elif defined(__GNUC__
) 103 return "Assertion failed";
105 return "Assertion failed (Error)";
107 return "Assertion failed (FATAL)";
110 std::ostringstream out;
111 out <<
"Assertion failed (level=" << nLevel <<
")";
120 out <<
"\n" << getTypeofLevel ( context.level() )
121 <<
" in " << context.file() <<
":" << context.contextLine() <<
'\n';
122 if ( !context.message().empty() )
129 out <<
"\nExpression: " << context.expression();
136 out <<
"\n" << getTypeofLevel ( context.level() )
137 <<
" in " << context.file() <<
":" << context.contextLine() <<
'\n';
138 if ( !context.message().empty() )
140 out <<
"User-friendly msg: '" << context.message() <<
"'\n";
142 out <<
"\nExpression: '" << context.expression() <<
"'\n";
145 const valueArray_Type& aVals = context
.values();
146 if ( !aVals.empty() )
148 bool bFirstTime =
true;
149 valueArray_Type::const_iterator first = aVals.begin(), last = aVals.end();
150 while ( first != last)
161 out << first->second <<
"='" << first->first <<
"'\n";
193 static bool ignore_all =
false;
199 typedef std::pair< std::string,
int> fileAndLine;
200 static std::set< fileAndLine> ignorer;
201 if ( ignorer.find ( fileAndLine ( context.file(), context.contextLine() ) ) != ignorer.end() )
208 std::cerr <<
"\nPress (I)gnore/ Igore (F)orever/ Ignore (A)ll/ (D)ebug/ A(b)ort: ";
212 bool bContinue =
true;
213 while ( bContinue && std::cin.get ( ch) )
226 ignorer.insert ( fileAndLine ( context.file(), context.contextLine() ) );
257 std::ostringstream out;
259 throw std::runtime_error ( out.str() );
297 defaultLoggerInfo.M_outputStream =
new std::ofstream ( str);
static void setLog(assertFunction_Type log)
void setDefaultLogName(const char *str)
void defaultFatalHandler(const AssertContext &context)
void defaultLogger(const AssertContext &context)
void dumpContextSummary(const AssertContext &context, std::ostream &out)
void updateInverseJacobian(const UInt &iQuadPt)
void defaultWarnHandler(const AssertContext &context)
void defaultDebugHandler(const AssertContext &context)
const valueArray_Type & values() const
static void setHandler(int nLevel, assertFunction_Type handler)
StreamHolder defaultLoggerInfo
contains details about a failed assertion
void setDefaultLogStream(std::ostream &out)
std::vector< valueAndString_Type > valueArray_Type
void defaultErrorHandler(const AssertContext &context)
void dumpContextDetail(const AssertContext &context, std::ostream &out)
const std::string & message() const
std::ostream * M_outputStream
std::string getTypeofLevel(int nLevel)