summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-06-20 17:50:54 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-23 14:00:04 +0200
commit03c14b836ab03735870b36c2388fd88782b97550 (patch)
treeed6a26ff81ec0cc5e6fbfa3dc8b201d9e1ac4097 /pyuno
parent6441c2f2e20bc424c6a4cd1c2d704710e4d80346 (diff)
[API CHANGE] Add a sal_debug method to pyuno
Does the obvious thing. Useful to get debug output from Python code at development time into the same format and in the same output file as from SAL_DEBUG() calls in C++ source code. Especially useful when combined with SAL_LOG=+TIMESTAMP or +RELATIVETIMER. Change-Id: I8c3d4fdf83b06846acb56773438401d467e71062 Reviewed-on: https://gerrit.libreoffice.org/56171 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/source/module/pyuno_module.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx
index a50ca379cf9a..9fe1f07f30b6 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -823,6 +823,20 @@ static PyObject *setCurrentContext(
return ret.getAcquired();
}
+static PyObject *sal_debug(
+ SAL_UNUSED_PARAMETER PyObject *, SAL_UNUSED_PARAMETER PyObject * args )
+{
+ Py_INCREF( Py_None );
+ if( !PyTuple_Check( args ) || PyTuple_Size( args) != 1 )
+ return Py_None;
+
+ OUString line = pyString2ustring( PyTuple_GetItem( args, 0 ) );
+
+ SAL_DEBUG(line.toUtf8().getStr());
+
+ return Py_None;
+}
+
}
struct PyMethodDef PyUNOModule_methods [] =
@@ -843,6 +857,7 @@ struct PyMethodDef PyUNOModule_methods [] =
{"invoke", invoke, METH_VARARGS | METH_KEYWORDS, nullptr},
{"setCurrentContext", setCurrentContext, METH_VARARGS, nullptr},
{"getCurrentContext", getCurrentContext, METH_VARARGS, nullptr},
+ {"sal_debug", sal_debug, METH_VARARGS, nullptr},
{nullptr, nullptr, 0, nullptr}
};