aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/pythonextensions/pyutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pythonextensions/pyutil.cpp')
-rw-r--r--plugins/pythonextensions/pyutil.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/plugins/pythonextensions/pyutil.cpp b/plugins/pythonextensions/pyutil.cpp
index b992e36..fd0d2cd 100644
--- a/plugins/pythonextensions/pyutil.cpp
+++ b/plugins/pythonextensions/pyutil.cpp
@@ -25,13 +25,14 @@
#include "pyutil.h"
+Q_LOGGING_CATEGORY(pyLog, "qtc.pythonextensions")
+
#ifdef Q_OS_UNIX
# include <dlfcn.h> // dlopen
#endif
#include <QtCore/QByteArray>
#include <QtCore/QCoreApplication>
-#include <QtCore/QDebug>
#include <QtCore/QStringList>
#include <QtCore/QTemporaryFile>
#include <QtCore/QDir>
@@ -121,7 +122,7 @@ State init()
} else {
if (pyErrorOccurred)
PyErr_Print();
- qWarning("Failed to initialize the QtCreator module.");
+ qCDebug(pyLog) << "Failed to initialize the QtCreator module.";
}
// The Python interpreter eats SIGINT, which is not what we want.
@@ -129,7 +130,7 @@ State init()
// See https://mail.python.org/pipermail/cplusplus-sig/2012-December/016858.html
if (!runSimpleString("import signal\n"
"signal.signal(signal.SIGINT, signal.SIG_DFL)")) {
- qWarning("Failed to prevent SIGINT capture.");
+ qCDebug(pyLog) << "Failed to prevent SIGINT capture.";
}
return state;
@@ -144,7 +145,7 @@ bool createModule(const std::string &moduleName)
if (!module) {
if (PyErr_Occurred())
PyErr_Print();
- qWarning() << __FUNCTION__ << "Failed to create module";
+ qCDebug(pyLog) << "Failed to create module" << QString::fromStdString(moduleName);
return false;
}
@@ -161,7 +162,7 @@ bool bindObject(const QString &moduleName, const QString &name, int index, void
PyObject *po = Shiboken::Conversions::pointerToPython(reinterpret_cast<SbkObjectType *>(typeObject), o);
if (!po) {
- qWarning() << __FUNCTION__ << "Failed to create wrapper for" << o;
+ qCDebug(pyLog) << "Failed to create wrapper for" << moduleName << name << index;
return false;
}
Py_INCREF(po);
@@ -184,14 +185,14 @@ bool bindPyObject(const QString &moduleName, const QString &name, void *obj)
if (!module) {
if (PyErr_Occurred())
PyErr_Print();
- qWarning() << __FUNCTION__ << "Failed to locate module" << moduleName;
+ qCDebug(pyLog) << "Failed to locate module" << moduleName;
return false;
}
if (PyModule_AddObject(module, name.toLocal8Bit().constData(), (PyObject *)obj) < 0) {
if (PyErr_Occurred())
PyErr_Print();
- qWarning() << __FUNCTION__ << "Failed to add object" << name << "to" << moduleName;
+ qCDebug(pyLog) << "Failed to add object" << name << "to" << moduleName;
return false;
}
@@ -204,14 +205,14 @@ bool bindSubPyObject(const QString &moduleName, const QString &name, void *obj)
if (!moduleDict) {
if (PyErr_Occurred())
PyErr_Print();
- qWarning("Could not obtain module dict");
+ qCDebug(pyLog) << "Could not obtain module dict";
return false;
}
PyObject *moduleItem = PyDict_GetItemString(moduleDict, name.toLocal8Bit().constData());
if (!moduleDict) {
if (PyErr_Occurred())
PyErr_Print();
- qWarning() << "Could not obtain module item" << name;
+ qCDebug(pyLog) << "Could not obtain module item" << name;
return false;
}
return bindPyObject(moduleName, name, (void *)moduleItem);