qt: Change logging category

* lang/qt/src/*: Change logging category to macro to QGPGME_LOG.

--
The old logging category macro had a typo and this way we
are more consistent with other logging rules. For example
you could write gpg.* in the logging conf.
This commit is contained in:
Andre Heinecke 2020-02-19 11:12:43 +01:00
parent ba08aadfa7
commit ec9690cf5c
No known key found for this signature in database
GPG Key ID: 2978E9D40CBABA5C
11 changed files with 58 additions and 55 deletions

3
NEWS
View File

@ -13,6 +13,9 @@ Noteworthy changes in version 1.14.0 (unreleased)
* qt: Added job API for gpg-card.
* qt: The logging category has been changed to gpg.qgpgme to be more
consistent with other qt logging categories.
* Interface changes relative to the 1.13.1 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gpgme_user_id_t EXTENDED: New field 'uidhash'.

View File

@ -20,7 +20,7 @@
# 02111-1307, USA
lib_LTLIBRARIES = libqgpgme.la
EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
gpgme_backend_debug.h qgpgme_version.h.in \
qgpgme_debug.h qgpgme_version.h.in \
QGpgmeConfig.cmake.in.in
qgpgme_sources = \
@ -35,7 +35,7 @@ qgpgme_sources = \
qgpgmesecretkeyexportjob.cpp qgpgmesignencryptjob.cpp \
qgpgmesignjob.cpp qgpgmesignkeyjob.cpp qgpgmeverifydetachedjob.cpp \
qgpgmeverifyopaquejob.cpp threadedjobmixin.cpp \
qgpgmekeyformailboxjob.cpp gpgme_backend_debug.cpp \
qgpgmekeyformailboxjob.cpp qgpgme_debug.cpp \
qgpgmetofupolicyjob.cpp qgpgmequickjob.cpp \
defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \
qgpgmegpgcardjob.cpp \

View File

@ -1,14 +0,0 @@
// This file is autogenerated by CMake: DO NOT EDIT
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gpgme_backend_debug.h"
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
Q_LOGGING_CATEGORY(GPGPME_BACKEND_LOG, "log_gpgme_backend", QtWarningMsg)
#else
Q_LOGGING_CATEGORY(GPGPME_BACKEND_LOG, "log_gpgme_backend")
#endif

View File

@ -1,11 +0,0 @@
// This file is autogenerated by CMake: DO NOT EDIT
#ifndef GPGPME_BACKEND_LOG_H
#define GPGPME_BACKEND_LOG_H
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(GPGPME_BACKEND_LOG)
#endif

View File

@ -0,0 +1,14 @@
// This file is autogenerated by CMake: DO NOT EDIT
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "qgpgme_debug.h"
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
Q_LOGGING_CATEGORY(QGPGME_LOG, "gpg.qgpgme", QtWarningMsg)
#else
Q_LOGGING_CATEGORY(QGPGME_LOG, "gpg.qgpgme")
#endif

View File

@ -0,0 +1,11 @@
// This file is autogenerated by CMake: DO NOT EDIT
#ifndef QGPGME_LOG_H
#define QGPGME_LOG_H
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(QGPGME_LOG)
#endif

View File

@ -46,7 +46,7 @@
#include "data.h"
#include <QDebug>
#include "gpgme_backend_debug.h"
#include "qgpgme_debug.h"
#include <QBuffer>
@ -68,7 +68,7 @@ static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread
const std::weak_ptr<QIODevice> &plainText_)
{
qCDebug(GPGPME_BACKEND_LOG);
qCDebug(QGPGME_LOG);
const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
const std::shared_ptr<QIODevice> plainText = plainText_.lock();
@ -86,7 +86,7 @@ static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread
const std::pair<DecryptionResult, VerificationResult> res = ctx->decryptAndVerify(indata, outdata);
Error ae;
const QString log = _detail::audit_log_as_html(ctx, ae);
qCDebug(GPGPME_BACKEND_LOG) << "End no plainText. Error: " << ae;
qCDebug(QGPGME_LOG) << "End no plainText. Error: " << ae;
return std::make_tuple(res.first, res.second, out.data(), log, ae);
} else {
QGpgME::QIODeviceDataProvider out(plainText);
@ -95,7 +95,7 @@ static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread
const std::pair<DecryptionResult, VerificationResult> res = ctx->decryptAndVerify(indata, outdata);
Error ae;
const QString log = _detail::audit_log_as_html(ctx, ae);
qCDebug(GPGPME_BACKEND_LOG) << "End plainText. Error: " << ae;
qCDebug(QGPGME_LOG) << "End plainText. Error: " << ae;
return std::make_tuple(res.first, res.second, QByteArray(), log, ae);
}

View File

@ -41,7 +41,7 @@
#include <QDir>
#include <QProcess>
#include "util.h"
#include "gpgme_backend_debug.h"
#include "qgpgme_debug.h"
/* We cannot have a timeout because key generation can
* take ages. Well maybe 10 minutes. */
@ -86,7 +86,7 @@ static QGpgMEGpgCardJob::result_type do_work(const QStringList &cmds, const QStr
proc.setProgram(path);
proc.setArguments(args);
qCDebug(GPGPME_BACKEND_LOG) << "Executing:" << path << args;
qCDebug(QGPGME_LOG) << "Executing:" << path << args;
proc.start();
if (!proc.waitForStarted()) {
return std::make_tuple (QString(), QString(), 1, QString(), Error());

View File

@ -39,7 +39,7 @@
#include "qgpgmenewcryptoconfig.h"
#include <QDebug>
#include "gpgme_backend_debug.h"
#include "qgpgme_debug.h"
#include <QFile>
#include <QDir>
@ -101,14 +101,14 @@ void QGpgMENewCryptoConfig::reloadConfiguration(bool)
<< "components:\n";
std::copy(components.begin(), components.end(),
std::ostream_iterator<Component>(ss, "\n"));
qCDebug(GPGPME_BACKEND_LOG) << ss.str().c_str();
qCDebug(QGPGME_LOG) << ss.str().c_str();
}
#endif
#if 0
TODO port?
if (error && showErrors) {
const QString wmsg = i18n("<qt>Failed to execute gpgconf:<p>%1</p></qt>", QString::fromLocal8Bit(error.asString()));
qCWarning(GPGPME_BACKEND_LOG) << wmsg; // to see it from test_cryptoconfig.cpp
qCWarning(QGPGME_LOG) << wmsg; // to see it from test_cryptoconfig.cpp
KMessageBox::error(0, wmsg);
}
#endif
@ -183,7 +183,7 @@ void QGpgMENewCryptoConfigComponent::setComponent(const Component &component)
group->m_entryNames.push_back(name);
group->m_entriesByName[name] = entry;
} else {
qCWarning(GPGPME_BACKEND_LOG) << "found no group for entry" << o.name() << "of component" << name();
qCWarning(QGPGME_LOG) << "found no group for entry" << o.name() << "of component" << name();
}
if (group) {
m_groupsByName[group->name()] = group;
@ -222,7 +222,7 @@ void QGpgMENewCryptoConfigComponent::sync(bool runtime)
{
Q_UNUSED(runtime) // runtime is always set by engine_gpgconf
if (const Error err = m_component.save()) {
qCWarning(GPGPME_BACKEND_LOG) << ":"
qCWarning(QGPGME_LOG) << ":"
<< "Error from gpgconf while saving configuration: %1"
<< QString::fromLocal8Bit(err.asString());
}
@ -279,7 +279,7 @@ static QString urlpart_encode(const QString &str)
QString enc(str);
enc.replace(QLatin1Char('%'), QStringLiteral("%25")); // first!
enc.replace(QLatin1Char(':'), QStringLiteral("%3a"));
//qCDebug(GPGPME_BACKEND_LOG) <<" urlpart_encode:" << str <<" ->" << enc;
//qCDebug(QGPGME_LOG) <<" urlpart_encode:" << str <<" ->" << enc;
return enc;
}
@ -326,7 +326,7 @@ QVariant QGpgMENewCryptoConfigEntry::stringToValue(const QString &str, bool unes
bool ok = true;
const QVariant v = str.isEmpty() ? 0U : str.toUInt(&ok);
if (!ok) {
qCWarning(GPGPME_BACKEND_LOG) << "list-of-none should have an unsigned int as value:" << str;
qCWarning(QGPGME_LOG) << "list-of-none should have an unsigned int as value:" << str;
}
return v;
}
@ -340,7 +340,7 @@ QVariant QGpgMENewCryptoConfigEntry::stringToValue(const QString &str, bool unes
continue;
} else if (unescape) {
if (val[0] != '"') { // see README.gpgconf
qCWarning(GPGPME_BACKEND_LOG) << "String value should start with '\"' :" << val;
qCWarning(QGPGME_LOG) << "String value should start with '\"' :" << val;
}
val = val.mid(1);
}
@ -355,7 +355,7 @@ QVariant QGpgMENewCryptoConfigEntry::stringToValue(const QString &str, bool unes
return QVariant(QString()); // not set [ok with lists too?]
} else if (unescape) {
if (val[0] != '"') { // see README.gpgconf
qCWarning(GPGPME_BACKEND_LOG) << "String value should start with '\"' :" << val;
qCWarning(QGPGME_LOG) << "String value should start with '\"' :" << val;
}
val = val.mid(1);
}
@ -369,7 +369,7 @@ QGpgMENewCryptoConfigEntry::~QGpgMENewCryptoConfigEntry()
{
#ifndef NDEBUG
if (!s_duringClear && m_option.dirty())
qCWarning(GPGPME_BACKEND_LOG) << "Deleting a QGpgMENewCryptoConfigEntry that was modified (" << m_option.description() << ")"
qCWarning(QGPGME_LOG) << "Deleting a QGpgMENewCryptoConfigEntry that was modified (" << m_option.description() << ")"
<< "You forgot to call sync() (to commit) or clear() (to discard)";
#endif
}
@ -480,7 +480,7 @@ static QUrl parseURL(int mRealArgType, const QString &str)
if (ok) {
url.setPort(port);
} else if (!it->isEmpty()) {
qCWarning(GPGPME_BACKEND_LOG) << "parseURL: malformed LDAP server port, ignoring: \"" << *it << "\"";
qCWarning(QGPGME_LOG) << "parseURL: malformed LDAP server port, ignoring: \"" << *it << "\"";
}
const QString userName = urlpart_decode(*it++);
@ -494,7 +494,7 @@ static QUrl parseURL(int mRealArgType, const QString &str)
url.setQuery(urlpart_decode(*it));
return url;
} else {
qCWarning(GPGPME_BACKEND_LOG) << "parseURL: malformed LDAP server:" << str;
qCWarning(QGPGME_LOG) << "parseURL: malformed LDAP server:" << str;
}
}
// other URLs : assume wellformed URL syntax.
@ -700,7 +700,7 @@ QString QGpgMENewCryptoConfigEntry::toString(bool escape) const
}
}
QString res = lst.join(",");
//qCDebug(GPGPME_BACKEND_LOG) <<"toString:" << res;
//qCDebug(QGPGME_LOG) <<"toString:" << res;
return res;
} else { // normal string
QString res = mValue.toString();

View File

@ -41,7 +41,7 @@
#include "qgpgmerefreshkeysjob.h"
#include <QDebug>
#include "gpgme_backend_debug.h"
#include "qgpgme_debug.h"
#include "context.h"
@ -157,18 +157,18 @@ void QGpgME::QGpgMERefreshKeysJob::slotStatus(QProcess *proc, const QString &typ
if (type == QLatin1String("ERROR")) {
if (args.size() < 2) {
qCDebug(GPGPME_BACKEND_LOG) << "not recognising ERROR with < 2 args!";
qCDebug(QGPGME_LOG) << "not recognising ERROR with < 2 args!";
return;
}
const int source = (*++it).toInt(&ok);
if (!ok) {
qCDebug(GPGPME_BACKEND_LOG) << "expected number for first ERROR arg, got something else";
qCDebug(QGPGME_LOG) << "expected number for first ERROR arg, got something else";
return;
}
ok = false;
const int code = (*++it).toInt(&ok);
if (!ok) {
qCDebug(GPGPME_BACKEND_LOG) << "expected number for second ERROR arg, got something else";
qCDebug(QGPGME_LOG) << "expected number for second ERROR arg, got something else";
return;
}
mError = GpgME::Error::fromCode(code, source);
@ -176,26 +176,26 @@ void QGpgME::QGpgMERefreshKeysJob::slotStatus(QProcess *proc, const QString &typ
} else if (type == QLatin1String("PROGRESS")) {
if (args.size() < 4) {
qCDebug(GPGPME_BACKEND_LOG) << "not recognising PROGRESS with < 4 args!";
qCDebug(QGPGME_LOG) << "not recognising PROGRESS with < 4 args!";
return;
}
const QString what = *++it;
ok = false;
(*++it).toInt(&ok);
if (!ok) {
qCDebug(GPGPME_BACKEND_LOG) << "expected number for \"type\", got something else";
qCDebug(QGPGME_LOG) << "expected number for \"type\", got something else";
return;
}
ok = false;
const int cur = (*++it).toInt(&ok);
if (!ok) {
qCDebug(GPGPME_BACKEND_LOG) << "expected number for \"cur\", got something else";
qCDebug(QGPGME_LOG) << "expected number for \"cur\", got something else";
return;
}
ok = false;
const int total = (*++it).toInt(&ok);
if (!ok) {
qCDebug(GPGPME_BACKEND_LOG) << "expected number for \"total\", got something else";
qCDebug(QGPGME_LOG) << "expected number for \"total\", got something else";
return;
}
// TODO port

View File

@ -39,7 +39,7 @@
#include "qgpgmesecretkeyexportjob.h"
#include <QDebug>
#include "gpgme_backend_debug.h"
#include "qgpgme_debug.h"
#include "context.h"
#include "data.h"