44 #include <boost/lexical_cast.hpp>    47 # include <execinfo.h>    51 #include <lifev/core/LifeV.hpp>    52 #include <lifev/core/util/LifeDebug.hpp>   100     static bool alloc = 
false;
   101     if ( alloc == 
false )
   103         DEBUG_AREA = 
new std::string ( 
"" );
   104         AREAS = 
new std::list<
int>;
   105         StringNull = 
new std::string ( 
"" );
   106         DebugAreas = 
new std::map<
unsigned int, std::string>;
   111         std::ostringstream path;
   112         path << LIFEV_PREFIX << 
"/share/lifev/debug.areas";
   114         std::ifstream fin ( path.str().c_str() );
   117             fin.open ( 
"../debug.areas" );
   120                 Warning() << 
"The file debug.areas was not found.\n"   121                           << 
"                 searched at ../debug.areas and\n"   122                           << 
"                 " << path.str() << 
"\n";
   128             fin.getline ( line, 256 );
   129             if ( line[ 0 ] == 
'\0' ||
   132                     isspace ( line[ 0 ] ) )
   136             std::istringstream sentry ( line );
   137             std::vector<std::string> l;
   138             std::copy ( std::istream_iterator<std::string, 
char> ( sentry ),
   139                         std::istream_iterator<std::string, 
char> (),
   140                         std::back_inserter ( l ) );
   141             DebugAreas->insert ( std::make_pair ( std::atoi ( l[0].c_str() ), l[2] ) );
   144         char* env = getenv (
"DEBUG");
   152         std::copy ( std::istream_iterator<
int, 
char> ( is ),
   153                     std::istream_iterator<
int, 
char> (),
   154                     std::back_inserter ( *AREAS ) );
   156         DebugAreas->insert ( std::make_pair ( 0, 
"" ) );
   162     if ( DebugAreas->empty() )
   164         return std::string ( 
"Area " ) + std::to_string (area);
   167     std::map<
unsigned int, std::string>::iterator entry_it = DebugAreas->find ( area );
   169     if ( entry_it != DebugAreas->end() )
   171         return entry_it->second;
   175         return std::string ( 
"Area " ) + std::to_string (area);
   192     if ( DEBUG_AREA && ! DEBUG_AREA->empty() )
   194         M_data->debug =  ( std::find ( AREAS->begin (), AREAS->end (), area ) != AREAS->end() &&
   204         M_data->M_output << getDescription ( area ) << 
": ";
   214     if ( DEBUG_AREA && ! DEBUG_AREA->empty() )
   216         M_data->debug =  ( std::find ( AREAS->begin (), AREAS->end (), area ) != AREAS->end() &&
   225         M_data->M_output << getDescription ( area ) << 
": "   249         M_data->M_output  << s;
   251     if ( s[strlen (s) - 1] == 
'\n')
   262         M_data->M_output  << s;
   274     if ( s[s.size() - 1] == 
'\n')
   301     if ( !M_data->M_output.str().empty() )
   305             Private::S_logfile << M_data->M_output.str();
   309             std::cerr << M_data->M_output.str();
   313             M_data->flushFunction ( 
"%s", M_data->M_output.str().c_str() );
   315         M_data->M_output.str ( 
"" );
   329     std::ostringstream filename;
   332     if ( Private::S_logfile.is_open() )
   334         Private::S_logfile.close();
   337     Private::S_logfile.open ( filename.str().c_str(), std::ios::out );
   339     if ( Private::S_logfile.fail() )
   341         Warning() << 
"DebugStream::attach( " << logfile.c_str() << 
" ) failed to open "  << filename.str() << 
"\n";
   342         Warning() << 
"Redirecting to default output\n";
   345     else if ( Private::S_logfile.is_open() )
   347         Private::S_logfile << filename.str() << 
" is opened for debug" << std::endl;
   364 #ifdef HAVE_LIFEV_DEBUG   455 #ifdef HAVE_BACKTRACE   476     for (
int i = 0; 
i < 
n; ++
i)
   491     s << 
" " << strerror ( errno );
 DebugStream Warning(bool cond, int area=0)
 
DebugStream Fatal(int area=0)
 
static std::list< int > * AREAS
 
DebugStream(DebugStream const &)
 
std::ostringstream M_output
 
DebugStream(int area=0, int level=1, bool print=true)
 
void setFlush(stprintf=0)
 
LifeV::DebugStream & flush(LifeV::DebugStream &s)
 
LifeV::DebugStream & perror(LifeV::DebugStream &s)
 
std::string getDescription(unsigned int area)
 
DebugStream Warning(int area=0)
 
void updateInverseJacobian(const UInt &iQuadPt)
 
DebugStream Error(bool cond, int area=0)
 
int(* stprintf)(const char *format,...)
 
static std::string * StringNull
 
DebugStream Fatal(bool cond, int area=0)
 
static std::map< unsigned int, std::string > * DebugAreas
 
DebugStream Error(int area=0)
 
static std::ofstream S_logfile
 
DebugStream(const char *initialString, int area=0, int level=1, bool print=true)
 
static std::string * DEBUG_AREA
 
LifeV::DebugStream & endl(LifeV::DebugStream &s)