mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge pull request #4448 from laanwj/2014_07_qt_payment_rq_logging
qt: Always log warning/error messages to debug.log
This commit is contained in:
commit
f04f123407
@ -114,7 +114,7 @@ public:
|
|||||||
case CT_NEW:
|
case CT_NEW:
|
||||||
if(inModel)
|
if(inModel)
|
||||||
{
|
{
|
||||||
qDebug() << "AddressTablePriv::updateEntry : Warning: Got CT_NEW, but entry is already in model";
|
qWarning() << "AddressTablePriv::updateEntry : Warning: Got CT_NEW, but entry is already in model";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex);
|
parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex);
|
||||||
@ -124,7 +124,7 @@ public:
|
|||||||
case CT_UPDATED:
|
case CT_UPDATED:
|
||||||
if(!inModel)
|
if(!inModel)
|
||||||
{
|
{
|
||||||
qDebug() << "AddressTablePriv::updateEntry : Warning: Got CT_UPDATED, but entry is not in model";
|
qWarning() << "AddressTablePriv::updateEntry : Warning: Got CT_UPDATED, but entry is not in model";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lower->type = newEntryType;
|
lower->type = newEntryType;
|
||||||
@ -134,7 +134,7 @@ public:
|
|||||||
case CT_DELETED:
|
case CT_DELETED:
|
||||||
if(!inModel)
|
if(!inModel)
|
||||||
{
|
{
|
||||||
qDebug() << "AddressTablePriv::updateEntry : Warning: Got CT_DELETED, but entry is not in model";
|
qWarning() << "AddressTablePriv::updateEntry : Warning: Got CT_DELETED, but entry is not in model";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex-1);
|
parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex-1);
|
||||||
|
@ -126,15 +126,15 @@ static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTrans
|
|||||||
#if QT_VERSION < 0x050000
|
#if QT_VERSION < 0x050000
|
||||||
void DebugMessageHandler(QtMsgType type, const char *msg)
|
void DebugMessageHandler(QtMsgType type, const char *msg)
|
||||||
{
|
{
|
||||||
Q_UNUSED(type);
|
const char *category = (type == QtDebugMsg) ? "qt" : NULL;
|
||||||
LogPrint("qt", "GUI: %s\n", msg);
|
LogPrint(category, "GUI: %s\n", msg);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString &msg)
|
void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString &msg)
|
||||||
{
|
{
|
||||||
Q_UNUSED(type);
|
|
||||||
Q_UNUSED(context);
|
Q_UNUSED(context);
|
||||||
LogPrint("qt", "GUI: %s\n", qPrintable(msg));
|
const char *category = (type == QtDebugMsg) ? "qt" : NULL;
|
||||||
|
LogPrint(category, "GUI: %s\n", QString::toStdString(msg));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -29,18 +29,18 @@ bool PaymentRequestPlus::parse(const QByteArray& data)
|
|||||||
{
|
{
|
||||||
bool parseOK = paymentRequest.ParseFromArray(data.data(), data.size());
|
bool parseOK = paymentRequest.ParseFromArray(data.data(), data.size());
|
||||||
if (!parseOK) {
|
if (!parseOK) {
|
||||||
qDebug() << "PaymentRequestPlus::parse : Error parsing payment request";
|
qWarning() << "PaymentRequestPlus::parse : Error parsing payment request";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (paymentRequest.payment_details_version() > 1) {
|
if (paymentRequest.payment_details_version() > 1) {
|
||||||
qDebug() << "PaymentRequestPlus::parse : Received up-version payment details, version=" << paymentRequest.payment_details_version();
|
qWarning() << "PaymentRequestPlus::parse : Received up-version payment details, version=" << paymentRequest.payment_details_version();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
parseOK = details.ParseFromString(paymentRequest.serialized_payment_details());
|
parseOK = details.ParseFromString(paymentRequest.serialized_payment_details());
|
||||||
if (!parseOK)
|
if (!parseOK)
|
||||||
{
|
{
|
||||||
qDebug() << "PaymentRequestPlus::parse : Error parsing payment details";
|
qWarning() << "PaymentRequestPlus::parse : Error parsing payment details";
|
||||||
paymentRequest.Clear();
|
paymentRequest.Clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -80,17 +80,17 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
|
|||||||
digestAlgorithm = EVP_sha1();
|
digestAlgorithm = EVP_sha1();
|
||||||
}
|
}
|
||||||
else if (paymentRequest.pki_type() == "none") {
|
else if (paymentRequest.pki_type() == "none") {
|
||||||
qDebug() << "PaymentRequestPlus::getMerchant : Payment request: pki_type == none";
|
qWarning() << "PaymentRequestPlus::getMerchant : Payment request: pki_type == none";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qDebug() << "PaymentRequestPlus::getMerchant : Payment request: unknown pki_type " << QString::fromStdString(paymentRequest.pki_type());
|
qWarning() << "PaymentRequestPlus::getMerchant : Payment request: unknown pki_type " << QString::fromStdString(paymentRequest.pki_type());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
payments::X509Certificates certChain;
|
payments::X509Certificates certChain;
|
||||||
if (!certChain.ParseFromString(paymentRequest.pki_data())) {
|
if (!certChain.ParseFromString(paymentRequest.pki_data())) {
|
||||||
qDebug() << "PaymentRequestPlus::getMerchant : Payment request: error parsing pki_data";
|
qWarning() << "PaymentRequestPlus::getMerchant : Payment request: error parsing pki_data";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,12 +100,12 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
|
|||||||
QByteArray certData(certChain.certificate(i).data(), certChain.certificate(i).size());
|
QByteArray certData(certChain.certificate(i).data(), certChain.certificate(i).size());
|
||||||
QSslCertificate qCert(certData, QSsl::Der);
|
QSslCertificate qCert(certData, QSsl::Der);
|
||||||
if (currentTime < qCert.effectiveDate() || currentTime > qCert.expiryDate()) {
|
if (currentTime < qCert.effectiveDate() || currentTime > qCert.expiryDate()) {
|
||||||
qDebug() << "PaymentRequestPlus::getMerchant : Payment request: certificate expired or not yet active: " << qCert;
|
qWarning() << "PaymentRequestPlus::getMerchant : Payment request: certificate expired or not yet active: " << qCert;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
if (qCert.isBlacklisted()) {
|
if (qCert.isBlacklisted()) {
|
||||||
qDebug() << "PaymentRequestPlus::getMerchant : Payment request: certificate blacklisted: " << qCert;
|
qWarning() << "PaymentRequestPlus::getMerchant : Payment request: certificate blacklisted: " << qCert;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -115,7 +115,7 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
|
|||||||
certs.push_back(cert);
|
certs.push_back(cert);
|
||||||
}
|
}
|
||||||
if (certs.empty()) {
|
if (certs.empty()) {
|
||||||
qDebug() << "PaymentRequestPlus::getMerchant : Payment request: empty certificate chain";
|
qWarning() << "PaymentRequestPlus::getMerchant : Payment request: empty certificate chain";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
|
|||||||
// load the signing cert into it and verify.
|
// load the signing cert into it and verify.
|
||||||
X509_STORE_CTX *store_ctx = X509_STORE_CTX_new();
|
X509_STORE_CTX *store_ctx = X509_STORE_CTX_new();
|
||||||
if (!store_ctx) {
|
if (!store_ctx) {
|
||||||
qDebug() << "PaymentRequestPlus::getMerchant : Payment request: error creating X509_STORE_CTX";
|
qWarning() << "PaymentRequestPlus::getMerchant : Payment request: error creating X509_STORE_CTX";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
|
|||||||
catch (SSLVerifyError& err)
|
catch (SSLVerifyError& err)
|
||||||
{
|
{
|
||||||
fResult = false;
|
fResult = false;
|
||||||
qDebug() << "PaymentRequestPlus::getMerchant : SSL error: " << err.what();
|
qWarning() << "PaymentRequestPlus::getMerchant : SSL error: " << err.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (website)
|
if (website)
|
||||||
|
@ -90,7 +90,7 @@ static QList<QString> savedPaymentRequests;
|
|||||||
|
|
||||||
static void ReportInvalidCertificate(const QSslCertificate& cert)
|
static void ReportInvalidCertificate(const QSslCertificate& cert)
|
||||||
{
|
{
|
||||||
qDebug() << "ReportInvalidCertificate : Payment server found an invalid certificate: " << cert.subjectInfo(QSslCertificate::CommonName);
|
qWarning() << "ReportInvalidCertificate : Payment server found an invalid certificate: " << cert.subjectInfo(QSslCertificate::CommonName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -161,7 +161,7 @@ void PaymentServer::LoadRootCAs(X509_STORE* _store)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qDebug() << "PaymentServer::LoadRootCAs : Loaded " << nRootCerts << " root certificates";
|
qWarning() << "PaymentServer::LoadRootCAs : Loaded " << nRootCerts << " root certificates";
|
||||||
|
|
||||||
// Project for another day:
|
// Project for another day:
|
||||||
// Fetch certificate revocation lists, and add them to certStore.
|
// Fetch certificate revocation lists, and add them to certStore.
|
||||||
@ -223,7 +223,7 @@ bool PaymentServer::ipcParseCommandLine(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
// Printing to debug.log is about the best we can do here, the
|
// Printing to debug.log is about the best we can do here, the
|
||||||
// GUI hasn't started yet so we can't pop up a message box.
|
// GUI hasn't started yet so we can't pop up a message box.
|
||||||
qDebug() << "PaymentServer::ipcSendCommandLine : Payment request file does not exist: " << arg;
|
qWarning() << "PaymentServer::ipcSendCommandLine : Payment request file does not exist: " << arg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -403,7 +403,7 @@ void PaymentServer::handleURIOrFile(const QString& s)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "PaymentServer::handleURIOrFile : Invalid URL: " << fetchUrl;
|
qWarning() << "PaymentServer::handleURIOrFile : Invalid URL: " << fetchUrl;
|
||||||
emit message(tr("URI handling"),
|
emit message(tr("URI handling"),
|
||||||
tr("Payment request fetch URL is invalid: %1").arg(fetchUrl.toString()),
|
tr("Payment request fetch URL is invalid: %1").arg(fetchUrl.toString()),
|
||||||
CClientUIInterface::ICON_WARNING);
|
CClientUIInterface::ICON_WARNING);
|
||||||
@ -476,13 +476,13 @@ bool PaymentServer::readPaymentRequest(const QString& filename, PaymentRequestPl
|
|||||||
QFile f(filename);
|
QFile f(filename);
|
||||||
if (!f.open(QIODevice::ReadOnly))
|
if (!f.open(QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
qDebug() << "PaymentServer::readPaymentRequest : Failed to open " << filename;
|
qWarning() << "PaymentServer::readPaymentRequest : Failed to open " << filename;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f.size() > MAX_PAYMENT_REQUEST_SIZE)
|
if (f.size() > MAX_PAYMENT_REQUEST_SIZE)
|
||||||
{
|
{
|
||||||
qDebug() << "PaymentServer::readPaymentRequest : " << filename << " too large";
|
qWarning() << "PaymentServer::readPaymentRequest : " << filename << " too large";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,7 +624,7 @@ void PaymentServer::fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipien
|
|||||||
else {
|
else {
|
||||||
// This should never happen, because sending coins should have
|
// This should never happen, because sending coins should have
|
||||||
// just unlocked the wallet and refilled the keypool.
|
// just unlocked the wallet and refilled the keypool.
|
||||||
qDebug() << "PaymentServer::fetchPaymentACK : Error getting refund key, refund_to not set";
|
qWarning() << "PaymentServer::fetchPaymentACK : Error getting refund key, refund_to not set";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,7 +636,7 @@ void PaymentServer::fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipien
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// This should never happen, either.
|
// This should never happen, either.
|
||||||
qDebug() << "PaymentServer::fetchPaymentACK : Error serializing payment message";
|
qWarning() << "PaymentServer::fetchPaymentACK : Error serializing payment message";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -649,7 +649,7 @@ void PaymentServer::netRequestFinished(QNetworkReply* reply)
|
|||||||
.arg(reply->request().url().toString())
|
.arg(reply->request().url().toString())
|
||||||
.arg(reply->errorString());
|
.arg(reply->errorString());
|
||||||
|
|
||||||
qDebug() << "PaymentServer::netRequestFinished : " << msg;
|
qWarning() << "PaymentServer::netRequestFinished : " << msg;
|
||||||
emit message(tr("Payment request error"), msg, CClientUIInterface::MSG_ERROR);
|
emit message(tr("Payment request error"), msg, CClientUIInterface::MSG_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -663,7 +663,7 @@ void PaymentServer::netRequestFinished(QNetworkReply* reply)
|
|||||||
SendCoinsRecipient recipient;
|
SendCoinsRecipient recipient;
|
||||||
if (!request.parse(data))
|
if (!request.parse(data))
|
||||||
{
|
{
|
||||||
qDebug() << "PaymentServer::netRequestFinished : Error parsing payment request";
|
qWarning() << "PaymentServer::netRequestFinished : Error parsing payment request";
|
||||||
emit message(tr("Payment request error"),
|
emit message(tr("Payment request error"),
|
||||||
tr("Payment request can not be parsed!"),
|
tr("Payment request can not be parsed!"),
|
||||||
CClientUIInterface::MSG_ERROR);
|
CClientUIInterface::MSG_ERROR);
|
||||||
@ -681,7 +681,7 @@ void PaymentServer::netRequestFinished(QNetworkReply* reply)
|
|||||||
QString msg = tr("Bad response from server %1")
|
QString msg = tr("Bad response from server %1")
|
||||||
.arg(reply->request().url().toString());
|
.arg(reply->request().url().toString());
|
||||||
|
|
||||||
qDebug() << "PaymentServer::netRequestFinished : " << msg;
|
qWarning() << "PaymentServer::netRequestFinished : " << msg;
|
||||||
emit message(tr("Payment request error"), msg, CClientUIInterface::MSG_ERROR);
|
emit message(tr("Payment request error"), msg, CClientUIInterface::MSG_ERROR);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -697,7 +697,7 @@ void PaymentServer::reportSslErrors(QNetworkReply* reply, const QList<QSslError>
|
|||||||
|
|
||||||
QString errString;
|
QString errString;
|
||||||
foreach (const QSslError& err, errs) {
|
foreach (const QSslError& err, errs) {
|
||||||
qDebug() << "PaymentServer::reportSslErrors : " << err;
|
qWarning() << "PaymentServer::reportSslErrors : " << err;
|
||||||
errString += err.errorString() + "\n";
|
errString += err.errorString() + "\n";
|
||||||
}
|
}
|
||||||
emit message(tr("Network request error"), errString, CClientUIInterface::MSG_ERROR);
|
emit message(tr("Network request error"), errString, CClientUIInterface::MSG_ERROR);
|
||||||
|
@ -130,12 +130,12 @@ public:
|
|||||||
case CT_NEW:
|
case CT_NEW:
|
||||||
if(inModel)
|
if(inModel)
|
||||||
{
|
{
|
||||||
qDebug() << "TransactionTablePriv::updateWallet : Warning: Got CT_NEW, but transaction is already in model";
|
qWarning() << "TransactionTablePriv::updateWallet : Warning: Got CT_NEW, but transaction is already in model";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!inWallet)
|
if(!inWallet)
|
||||||
{
|
{
|
||||||
qDebug() << "TransactionTablePriv::updateWallet : Warning: Got CT_NEW, but transaction is not in wallet";
|
qWarning() << "TransactionTablePriv::updateWallet : Warning: Got CT_NEW, but transaction is not in wallet";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(showTransaction)
|
if(showTransaction)
|
||||||
@ -159,7 +159,7 @@ public:
|
|||||||
case CT_DELETED:
|
case CT_DELETED:
|
||||||
if(!inModel)
|
if(!inModel)
|
||||||
{
|
{
|
||||||
qDebug() << "TransactionTablePriv::updateWallet : Warning: Got CT_DELETED, but transaction is not in model";
|
qWarning() << "TransactionTablePriv::updateWallet : Warning: Got CT_DELETED, but transaction is not in model";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Removed -- remove entire transaction from table
|
// Removed -- remove entire transaction from table
|
||||||
|
@ -45,13 +45,13 @@ void WinShutdownMonitor::registerShutdownBlockReason(const QString& strReason, c
|
|||||||
typedef BOOL (WINAPI *PSHUTDOWNBRCREATE)(HWND, LPCWSTR);
|
typedef BOOL (WINAPI *PSHUTDOWNBRCREATE)(HWND, LPCWSTR);
|
||||||
PSHUTDOWNBRCREATE shutdownBRCreate = (PSHUTDOWNBRCREATE)GetProcAddress(GetModuleHandleA("User32.dll"), "ShutdownBlockReasonCreate");
|
PSHUTDOWNBRCREATE shutdownBRCreate = (PSHUTDOWNBRCREATE)GetProcAddress(GetModuleHandleA("User32.dll"), "ShutdownBlockReasonCreate");
|
||||||
if (shutdownBRCreate == NULL) {
|
if (shutdownBRCreate == NULL) {
|
||||||
qDebug() << "registerShutdownBlockReason : GetProcAddress for ShutdownBlockReasonCreate failed";
|
qWarning() << "registerShutdownBlockReason : GetProcAddress for ShutdownBlockReasonCreate failed";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shutdownBRCreate(mainWinId, strReason.toStdWString().c_str()))
|
if (shutdownBRCreate(mainWinId, strReason.toStdWString().c_str()))
|
||||||
qDebug() << "registerShutdownBlockReason : Successfully registered: " + strReason;
|
qWarning() << "registerShutdownBlockReason : Successfully registered: " + strReason;
|
||||||
else
|
else
|
||||||
qDebug() << "registerShutdownBlockReason : Failed to register: " + strReason;
|
qWarning() << "registerShutdownBlockReason : Failed to register: " + strReason;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user