summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2014-09-19 10:38:32 +0200
committerPatrick Ohly <patrick.ohly@intel.com>2014-09-19 10:41:42 +0200
commit9d7c10b0d914ab94ac363bd919b265c2e1880663 (patch)
treededafb4ba116870898895c56438f2aedd2494409
parent32ed5e2352f41e1098acafa52e2561b690cfaf9b (diff)
downloadpycrosswalk-9d7c10b0d914ab94ac363bd919b265c2e1880663.tar.gz
pycrosswalk-9d7c10b0d914ab94ac363bd919b265c2e1880663.tar.bz2
pycrosswalk-9d7c10b0d914ab94ac363bd919b265c2e1880663.zip
adding some disabled logging
These printf()s were useful when debugging why Cloudeebus was unable to process incoming D-Bus communication. Instead of adding them manually each time they are needed, let's keep them in the code, disabled via a single define.
-rw-r--r--src/pycrosswalk.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/pycrosswalk.c b/src/pycrosswalk.c
index a11ca98..5e3ebfb 100644
--- a/src/pycrosswalk.c
+++ b/src/pycrosswalk.c
@@ -52,6 +52,8 @@ static PyMethodDef PyXWalkMethods[] = {
static const char PY_XWALK_MODULE_NAME[] = "xwalk";
+// #define LOGGING 1
+
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef PyXWalkModule = {
PyModuleDef_HEAD_INIT,
@@ -69,6 +71,9 @@ static PyObject* py_post_message(PyObject* self, PyObject* args) {
Py_RETURN_FALSE;
}
+#ifdef LOGGING
+ fprintf(stderr, "pycrosswalk %d: posting message: %s\n", instance, result);
+#endif
g_xw_messaging->PostMessage(instance, result);
Py_RETURN_TRUE;
@@ -180,6 +185,9 @@ static char* py_handle_message(XW_Instance instance,
return NULL;
}
+#ifdef LOGGING
+ fprintf(stderr, "pycrosswalk %d: handling message: %s\n", instance, message);
+#endif
PyObject* result_object = PyObject_CallObject(callback, args);
Py_DECREF(args);
@@ -197,8 +205,12 @@ static char* py_handle_message(XW_Instance instance,
char* result_string = str ? PyBytes_AsString(str) : NULL;
#endif
;
- if (result_string)
+ if (result_string) {
+#ifdef LOGGING
+ fprintf(stderr, "pycrosswalk %d: message handling result: %s\n", instance, result_string);
+#endif
pass_string = strdup(result_string);
+ }
Py_DECREF(result_object);