Extract TO_LOG_MESSAGE()

This commit is contained in:
Igor Kushnir 2022-11-25 15:24:42 +02:00 committed by Abs62
parent be22bb9ffd
commit a61b203de7

View file

@ -7,6 +7,8 @@
#include <QString> #include <QString>
#include "gddebug.hh" #include "gddebug.hh"
#define TO_LOG_MESSAGE( msg, ap ) QString().vsprintf( msg, ap ).toUtf8().constData()
QFile * logFilePtr; QFile * logFilePtr;
namespace { namespace {
@ -65,7 +67,7 @@ void gdWarning(const char *msg, ...)
va_start(ap, msg); va_start(ap, msg);
{ {
Utf8CodecForLocaleReplacer codecReplacer; Utf8CodecForLocaleReplacer codecReplacer;
qWarning( "%s", QString().vsprintf( msg, ap ).toUtf8().constData() ); qWarning( "%s", TO_LOG_MESSAGE( msg, ap ) );
} }
va_end(ap); va_end(ap);
} }
@ -76,7 +78,7 @@ void gdDebug(const char *msg, ...)
va_start(ap, msg); va_start(ap, msg);
{ {
Utf8CodecForLocaleReplacer codecReplacer; Utf8CodecForLocaleReplacer codecReplacer;
qDebug( "%s", QString().vsprintf( msg, ap ).toUtf8().constData() ); qDebug( "%s", TO_LOG_MESSAGE( msg, ap ) );
} }
va_end(ap); va_end(ap);
} }