36 #include "LogFile.hpp"
46 mInitTime(time(NULL)),
73 void LogFile::Set(
unsigned level,
const std::string& rDirectory,
const std::string& rFileName)
78 <<
" should have been less than or equal to "
113 *
this <<
"\nChaste: " << simulationType <<
" simulation, on " << ctime(&
mInitTime) <<
"\n";
118 double fsecs = difftime(time(NULL),
mInitTime);
119 long total_secs =
static_cast<long>(floor(fsecs+0.5));
120 int total_mins = total_secs/60;
122 int secs = total_secs%60;
123 int mins = total_mins%60;
124 int hrs = total_mins/60;
126 *
this << pre <<
"Elapsed time is: " << hrs <<
"h " << mins <<
"m " << secs <<
"s\n";
136 assert(precision > 0);
void Set(unsigned level, const std::string &rDirectory, const std::string &rFileName="log.txt")
#define EXCEPTION(message)
static const unsigned mMaxLoggingLevel
out_stream OpenOutputFile(const std::string &rFileName, std::ios_base::openmode mode=std::ios::out|std::ios::trunc) const
static LogFile * mpInstance
void SetPrecision(unsigned precision)
void WriteHeader(std::string simulationType="")
void WriteElapsedTime(std::string pre="")
static LogFile * Instance()
static unsigned MaxLoggingLevel()