32 LogStream::LogStream() { }
33 LogStream::~LogStream()
35 if (mStream.is_open())
42 LogStream::LogStream(
const std::string& _file) : mFileName(_file)
46 struct tm *current_time;
47 time_t ctTime; time(&ctTime);
48 current_time = localtime( &ctTime );
51 if (mStream.is_open())
53 mStream <<
" ---------------------------------------------------------------------------------------------------------------------------------- " <<
std::endl;
54 mStream <<
" loging report for : "
55 << std::setw(2) << std::setfill(
'0') << current_time->tm_mon + 1 <<
"/"
56 << std::setw(2) << std::setfill(
'0') << current_time->tm_mday <<
"/"
57 << std::setw(4) << std::setfill(
'0') << current_time->tm_year + 1900 <<
" "
58 << std::setw(2) << std::setfill(
'0') << current_time->tm_hour <<
":"
59 << std::setw(2) << std::setfill(
'0') << current_time->tm_min <<
":"
60 << std::setw(2) << std::setfill(
'0') << current_time->tm_sec <<
std::endl;
61 mStream <<
" ---------------------------------------------------------------------------------------------------------------------------------- " << std::endl <<
std::endl;
68 void LogStream::start(
const std::string& _section,
const std::string& _level)
70 if (mStream.is_open())
78 struct tm *current_time;
79 time_t ctTime; time(&ctTime);
80 current_time = localtime( &ctTime );
82 if (!mFileName.empty())
84 mStream.open(mFileName.c_str(), std::ios_base::app);
85 if (mStream.is_open())
87 mStream << std::setw(2) << std::setfill(
'0') << current_time->tm_hour <<
":"
88 << std::setw(2) << std::setfill(
'0') << current_time->tm_min <<
":"
95 bool LogStream::getSTDOutputEnabled()
102 if (getSTDOutputEnabled()) std::cout << std::endl;
103 if (mStream.is_open())
105 mStream << std::endl;