]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
_pakfire: Add method to configure the log level
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Oct 2023 17:18:07 +0000 (17:18 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Oct 2023 17:18:07 +0000 (17:18 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/_pakfiremodule.c

index 0fb45a4f052a74076905148c6655d0c69f9115f3..77d025cbbe85810378eaeefdf7bd74624c5be62a 100644 (file)
@@ -188,6 +188,18 @@ static PyObject* _pakfire_native_arch(void) {
        return PyUnicode_FromString(arch);
 }
 
+static PyObject* _pakfire_set_log_level(PyObject* self, PyObject* args) {
+       int level = 0;
+
+       if (!PyArg_ParseTuple(args, "i", &level))
+               return NULL;
+
+       // Set the log level
+       pakfire_ctx_set_log_level(pakfire_ctx, level);
+
+       Py_RETURN_NONE;
+}
+
 static PyObject* _pakfire_supported_arches(void) {
        int r;
 
@@ -243,6 +255,12 @@ static PyObject* _pakfire_version_compare(PyObject* self, PyObject* args) {
 
 static PyMethodDef pakfireModuleMethods[] = {
        {"native_arch", (PyCFunction)_pakfire_native_arch, METH_NOARGS, NULL },
+       {
+               "set_log_level",
+               (PyCFunction)_pakfire_set_log_level,
+               METH_VARARGS,
+               NULL,
+       },
        {"supported_arches", (PyCFunction)_pakfire_supported_arches, METH_NOARGS, NULL },
        {
                "version_compare",