StelLogger.cpp   StelLogger.cpp 
skipping to change at line 257 skipping to change at line 257
} }
void StelLogger::deinit() void StelLogger::deinit()
{ {
qInstallMessageHandler(0); qInstallMessageHandler(0);
logFile.close(); logFile.close();
} }
void StelLogger::debugLogHandler(QtMsgType type, const QMessageLogContext& ctx, const QString& msg) void StelLogger::debugLogHandler(QtMsgType type, const QMessageLogContext& ctx, const QString& msg)
{ {
// *** NOTE: see original Qt source in qlogging.cpp (qDefaultMessage
Handler) for sensible default code
#if (QT_VERSION>=QT_VERSION_CHECK(5,4,0)) #if (QT_VERSION>=QT_VERSION_CHECK(5,4,0))
//use Qt to format the log message, if possible //use Qt to format the log message, if possible
//this uses the format set by qSetMessagePattern //this uses the format set by qSetMessagePattern
//or QT_MESSAGE_PATTERN environment var //or QT_MESSAGE_PATTERN environment var
QString fmt = qFormatLogMessage(type,ctx,msg); QString fmt = qFormatLogMessage(type,ctx,msg);
#else #else
Q_UNUSED(type) Q_UNUSED(type)
Q_UNUSED(ctx) Q_UNUSED(ctx)
QString fmt = msg; QString fmt = msg;
#endif #endif
//do nothing for null messages //do nothing for null messages
if(fmt.isNull()) if(fmt.isNull())
return; return;
//always append newline
fmt.append(QLatin1Char('\n'));
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
//Send debug messages to Debugger, if one is attached, instead of st derr //Send debug messages to Debugger, if one is attached, instead of st derr
//This seems to avoid output delays in Qt Creator, allowing for easi er debugging //This seems to avoid output delays in Qt Creator, allowing for easi er debugging
//Seems to work fine with MSVC and MinGW //Seems to work fine with MSVC and MinGW
if(IsDebuggerPresent()) if (IsDebuggerPresent())
OutputDebugStringW(reinterpret_cast<LPCWSTR>(fmt.utf16())); {
OutputDebugStringW(reinterpret_cast<const wchar_t *>(fmt.utf
16()));
}
else else
#endif #endif
//this does the same as the default handler in qlogging.cpp {
fprintf(stderr, "%s\n", qPrintable(fmt)); //this does the same as the default handler in qlogging.cpp
fflush(stderr); fprintf(stderr, "%s", qPrintable(fmt));
fflush(stderr);
}
writeLog(fmt); writeLog(fmt);
} }
void StelLogger::writeLog(QString msg) void StelLogger::writeLog(QString msg)
{ {
if (!msg.endsWith('\n'))
msg.append(QLatin1Char('\n'));
fileMutex.lock(); fileMutex.lock();
msg += "\n";
logFile.write(qPrintable(msg), msg.size()); logFile.write(qPrintable(msg), msg.size());
log += msg; log += msg;
fileMutex.unlock(); fileMutex.unlock();
} }
QString StelLogger::getMsvcVersionString(int ver) QString StelLogger::getMsvcVersionString(int ver)
{ {
QString version; QString version;
switch(ver) switch(ver)
{ {
 End of changes. 6 change blocks. 
6 lines changed or deleted 19 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/