mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-29 04:35:41 +08:00
improved debug messages in XBus
This commit is contained in:
@@ -31,23 +31,23 @@ class QXPlaneMessageHandler
|
|||||||
static void handler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
static void handler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||||
{
|
{
|
||||||
QByteArray localMsg = msg.toLocal8Bit();
|
QByteArray localMsg = msg.toLocal8Bit();
|
||||||
char *buffer = new char[64 + localMsg.size() + std::strlen(context.file) + std::strlen(context.function)];
|
char *buffer = new char[64 + localMsg.size() + std::strlen(context.file)];
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QtDebugMsg:
|
case QtDebugMsg:
|
||||||
std::sprintf(buffer, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
std::sprintf(buffer, "%s:%u: Debug: %s\n", context.file, context.line, localMsg.constData());
|
||||||
XPLMDebugString(buffer);
|
XPLMDebugString(buffer);
|
||||||
break;
|
break;
|
||||||
case QtWarningMsg:
|
case QtWarningMsg:
|
||||||
std::sprintf(buffer, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
std::sprintf(buffer, "%s:%u: Warning: %s\n", context.file, context.line, localMsg.constData());
|
||||||
XPLMDebugString(buffer);
|
XPLMDebugString(buffer);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case QtCriticalMsg:
|
case QtCriticalMsg:
|
||||||
std::sprintf(buffer, "Error: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
std::sprintf(buffer, "%s:%u: Error: %s\n", context.file, context.line, localMsg.constData());
|
||||||
XPLMDebugString(buffer);
|
XPLMDebugString(buffer);
|
||||||
break;
|
break;
|
||||||
case QtFatalMsg:
|
case QtFatalMsg:
|
||||||
std::sprintf(buffer, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
std::sprintf(buffer, "%s:%u: Fatal: %s\n", context.file, context.line, localMsg.constData());
|
||||||
XPLMDebugString(buffer);
|
XPLMDebugString(buffer);
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user