Fix: do not print an empty buffer ending with \n

This commit is contained in:
Gerhard Hoffmann 2023-06-22 15:19:17 +02:00
parent 809440ba95
commit e420f95eb0

View File

@ -68,6 +68,7 @@ void atbDebugOutput(QtMsgType type, const QMessageLogContext &context, const QSt
datetime.time().toString(format).toStdString().c_str(), datetime.time().toString(format).toStdString().c_str(),
fractional_part, fractional_part,
localMsg.constData()); localMsg.constData());
fprintf(stderr, "%s\n", buf);
} }
} break; } break;
case QtInfoMsg: { case QtInfoMsg: {
@ -77,6 +78,7 @@ void atbDebugOutput(QtMsgType type, const QMessageLogContext &context, const QSt
datetime.time().toString(format).toStdString().c_str(), datetime.time().toString(format).toStdString().c_str(),
fractional_part, fractional_part,
localMsg.constData()); localMsg.constData());
fprintf(stderr, "%s\n", buf);
} }
} break; } break;
case QtWarningMsg: { case QtWarningMsg: {
@ -86,6 +88,7 @@ void atbDebugOutput(QtMsgType type, const QMessageLogContext &context, const QSt
datetime.time().toString(format).toStdString().c_str(), datetime.time().toString(format).toStdString().c_str(),
fractional_part, fractional_part,
localMsg.constData()); localMsg.constData());
fprintf(stderr, "%s\n", buf);
} }
} break; } break;
case QtCriticalMsg: { case QtCriticalMsg: {
@ -96,6 +99,7 @@ void atbDebugOutput(QtMsgType type, const QMessageLogContext &context, const QSt
datetime.time().toString(format).toStdString().c_str(), datetime.time().toString(format).toStdString().c_str(),
fractional_part, fractional_part,
localMsg.constData()); localMsg.constData());
fprintf(stderr, "%s\n", buf);
} }
} break; } break;
case QtFatalMsg: { case QtFatalMsg: {
@ -107,6 +111,7 @@ void atbDebugOutput(QtMsgType type, const QMessageLogContext &context, const QSt
datetime.time().toString(format).toStdString().c_str(), datetime.time().toString(format).toStdString().c_str(),
fractional_part, fractional_part,
localMsg.constData()); localMsg.constData());
fprintf(stderr, "%s\n", buf);
} }
} break; } break;
default: { default: {
@ -115,7 +120,6 @@ void atbDebugOutput(QtMsgType type, const QMessageLogContext &context, const QSt
msg.toStdString().c_str()); msg.toStdString().c_str());
} }
} }
fprintf(stderr, "%s\n", buf);
} }
#endif #endif