pyuno/source/module/pyuno_module.cxx |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 03c14b836ab03735870b36c2388fd88782b97550
Author: Tor Lillqvist <t...@collabora.com>
Date:   Wed Jun 20 17:50:54 2018 +0300

    [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.gran...@collabora.co.uk>
    Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>

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}
 };
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to