Fix flushing

This commit is contained in:
Patrick von Reth 2015-08-15 00:46:45 +02:00
parent b3531f0c39
commit cebd73c094
1 changed files with 5 additions and 5 deletions

View File

@ -66,18 +66,18 @@ SnoreLog::SnoreLog(SnoreDebugLevels lvl):
SnoreLog::~SnoreLog() SnoreLog::~SnoreLog()
{ {
std::wstringstream sstream; std::wstringstream sstream;
sstream << QDateTime::currentDateTime().toString(QLatin1String("hh:mm:ss")).toLocal8Bit().constData() sstream << QDateTime::currentDateTime().toString(QLatin1String("hh:mm:ss")).toUtf8().constData()
<< ": " << m_msg.toLocal8Bit().constData() << std::endl; << ": " << m_msg.toUtf8().constData();
std::wstring message = sstream.str(); std::wstring message = sstream.str();
if (logFile) { if (logFile) {
*logFile << message.c_str(); *logFile << message.c_str() << "\n";
logFile->flush(); logFile->flush();
} }
if (m_lvl == SNORE_WARNING) { if (m_lvl == SNORE_WARNING) {
std::wcerr << message; std::wcerr << message << std::endl;
} else if (debugLevel >= m_lvl) { } else if (debugLevel >= m_lvl) {
std::wcout << message; std::wcout << message << std::endl;
} }
} }