From c941dd31fb0a9fdc1d4edc2be1dbb0408a8f300a Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 1 Feb 2018 11:54:01 +0000 Subject: [PATCH] python: Add function to set log level Signed-off-by: Michael Tremer --- src/python/locationmodule.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/python/locationmodule.c b/src/python/locationmodule.c index 03e4cf5..40b0c35 100644 --- a/src/python/locationmodule.c +++ b/src/python/locationmodule.c @@ -15,6 +15,7 @@ */ #include +#include #include "locationmodule.h" #include "as.h" @@ -30,7 +31,24 @@ static void location_free(void) { loc_unref(loc_ctx); } +static PyObject* set_log_level(PyObject* m, PyObject* args) { + int priority = LOG_INFO; + + if (!PyArg_ParseTuple(args, "i", &priority)) + return NULL; + + loc_set_log_priority(loc_ctx, priority); + + Py_RETURN_NONE; +} + static PyMethodDef location_module_methods[] = { + { + "set_log_level", + (PyCFunction)set_log_level, + METH_VARARGS, + NULL, + }, { NULL }, }; -- 2.39.2