]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
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)
committerStefan Metzmacher <metze@samba.org>
Mon, 24 Oct 2016 08:56:12 +0000 (10:56 +0200)
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 7ba50a200924119ac1a66759e4c1419ece03ba41)

source4/param/pyparam.c

index fde91e5886e67460fbbda24ab84c72f6e5e89acf..29fb9c483a42a93c63e4c176061e968217d519a0 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,