Use a different timestamp methode

This commit is contained in:
Patrick von Reth 2015-08-17 12:02:14 +02:00
parent cebd73c094
commit 4fc6e33cd4
1 changed files with 6 additions and 9 deletions

View File

@ -19,7 +19,7 @@
#include "log.h" #include "log.h"
#include <QApplication> #include <QApplication>
#include <QDateTime> #include <QTime>
#include <QDir> #include <QDir>
#include <QTextStream> #include <QTextStream>
@ -65,19 +65,16 @@ SnoreLog::SnoreLog(SnoreDebugLevels lvl):
SnoreLog::~SnoreLog() SnoreLog::~SnoreLog()
{ {
std::wstringstream sstream; QByteArray message = QTime::currentTime().toString(QLatin1String("hh:mm:ss: ")).toUtf8().constData();
sstream << QDateTime::currentDateTime().toString(QLatin1String("hh:mm:ss")).toUtf8().constData() message.append(m_msg.toUtf8().constData());
<< ": " << m_msg.toUtf8().constData();
std::wstring message = sstream.str();
if (logFile) { if (logFile) {
*logFile << message.c_str() << "\n"; *logFile << message.constData() << "\n";
logFile->flush(); logFile->flush();
} }
if (m_lvl == SNORE_WARNING) { if (m_lvl == SNORE_WARNING) {
std::wcerr << message << std::endl; std::wcerr << message.constData() << std::endl;
} else if (debugLevel >= m_lvl) { } else if (debugLevel >= m_lvl) {
std::wcout << message << std::endl; std::wcout << message.constData() << std::endl;
} }
} }