From b77601101871d6dd2af451ddb6b6db3fed1dbd99 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 27 Oct 2023 17:18:07 +0000 Subject: [PATCH] _pakfire: Add method to configure the log level Signed-off-by: Michael Tremer --- src/_pakfire/_pakfiremodule.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/_pakfire/_pakfiremodule.c b/src/_pakfire/_pakfiremodule.c index 0fb45a4f0..77d025cbb 100644 --- a/src/_pakfire/_pakfiremodule.c +++ b/src/_pakfire/_pakfiremodule.c @@ -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", -- 2.39.5