s4:param add log_level function to retrieve log level in Python code
authorChristian Ambach <ambi@samba.org>
Tue, 13 Sep 2016 08:48:03 +0000 (10:48 +0200)
committerChristian Ambach <ambi@samba.org>
Wed, 14 Sep 2016 17:31:20 +0000 (19:31 +0200)
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/param/pyparam.c

index 6a559999fb702248d487c17fc1b9df8d2392c157..60c464524479c7d4b83500cab7196bef6033c97f 100644 (file)
@@ -322,6 +322,13 @@ static PyObject *py_lp_dump_a_parameter(PyObject *self, PyObject *args)
 
 }
 
+static PyObject *py_lp_log_level(PyObject *self, PyObject *unused)
+{
+       int ret = DEBUGLEVEL_CLASS[DBGC_CLASS];
+       return PyInt_FromLong(ret);
+}
+
+
 static PyObject *py_samdb_url(PyObject *self, PyObject *unused)
 {
        struct loadparm_context *lp_ctx = PyLoadparmContext_AsLoadparmContext(self);
@@ -357,6 +364,8 @@ static PyMethodDef py_lp_ctx_methods[] = {
                "Get the server role." },
        { "dump", py_lp_dump, METH_VARARGS,
                "S.dump(stream, show_defaults=False)" },
+       { "log_level", py_lp_log_level, METH_NOARGS,
+               "S.log_level() -> int\n Get the active log level" },
        { "dump_a_parameter", py_lp_dump_a_parameter, METH_VARARGS,
                "S.dump_a_parameter(stream, name, service_name)" },
        { "samdb_url", py_samdb_url, METH_NOARGS,