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()
{
std::wstringstream sstream;
sstream << QDateTime::currentDateTime().toString(QLatin1String("hh:mm:ss")).toLocal8Bit().constData()
<< ": " << m_msg.toLocal8Bit().constData() << std::endl;
sstream << QDateTime::currentDateTime().toString(QLatin1String("hh:mm:ss")).toUtf8().constData()
<< ": " << m_msg.toUtf8().constData();
std::wstring message = sstream.str();
if (logFile) {
*logFile << message.c_str();
*logFile << message.c_str() << "\n";
logFile->flush();
}
if (m_lvl == SNORE_WARNING) {
std::wcerr << message;
std::wcerr << message << std::endl;
} else if (debugLevel >= m_lvl) {
std::wcout << message;
std::wcout << message << std::endl;
}
}