]> git.ipfire.org Git - pakfire.git/commitdiff
_pakfire: Translate log levels to Python
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Mar 2021 18:34:53 +0000 (18:34 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Mar 2021 18:34:53 +0000 (18:34 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/pakfire.c

index 48ebedb8555ac775c3287af2f59d8a49ea1abea9..cfb3ce08c3ee598a42336092a7b2a1034f4bd57c 100644 (file)
@@ -379,6 +379,17 @@ static int __Pakfire_execute_logging_callback(Pakfire pakfire, void* data,
        if (!Pakfire_execute_logging_callback)
                return 0;
 
+       // Translate priority to Python logging priorities
+       switch (priority) {
+               case LOG_INFO:
+                       priority = 20;
+                       break;
+
+               case LOG_ERR:
+                       priority = 40;
+                       break;
+       }
+
        // Create tuple with arguments for the callback function
        PyObject* args = Py_BuildValue("(is)", priority, line);
        if (!args)