From f871301bbfc06af74e97a7caf477cfbceff0dcfa Mon Sep 17 00:00:00 2001
From: Alexey Stratulat <alexey.stratulat@demlabs.net>
Date: Fri, 28 Jun 2019 18:15:30 +0700
Subject: [PATCH] Fixed log_it function. Previously, it contained an error and
 changed, stouting logging instead of displaying on the screen. Removed
 unnecessary function, no longer due to the implementation of the enumeration
 of the logging level in the libdapConnector

---
 src/libdap-python.c | 24 +-----------------------
 src/libdap-python.h |  2 --
 2 files changed, 1 insertion(+), 25 deletions(-)

diff --git a/src/libdap-python.c b/src/libdap-python.c
index 5806859..56da14d 100644
--- a/src/libdap-python.c
+++ b/src/libdap-python.c
@@ -43,28 +43,6 @@ static PyObject *dap_set_log_level(PyObject *self, PyObject *args){
     }
 }
 
-static dap_log_level_t convert_const_char_to_dap_log_level(const char* string){
-    if (strcmp(string,"DEBUG") == 0){
-        return L_DEBUG;
-    }
-    if (strcmp(string, "INFO") == 0){
-        return L_INFO;
-    }
-    if (strcmp(string, "NOTICE") == 0){
-        return L_NOTICE;
-    }
-    if (strcmp(string, "WARNING") == 0){
-        return L_WARNING;
-    }
-    if (strcmp(string, "ERROR") == 0){
-        return L_ERROR;
-    }
-    if (strcmp(string, "CRITICAL") == 0){
-        return L_CRITICAL;
-    }
-    return -1;
-}
-
 static PyObject* dap_log_it(PyObject* self, PyObject* args){
     short int log_level;
     const char* string_output;
@@ -73,7 +51,7 @@ static PyObject* dap_log_it(PyObject* self, PyObject* args){
     if (log_level < 0 || log_level > 5 ) {
         return PyLong_FromLong(-1);
     } else {
-        dap_log_level_set(log_level);
+        log_it(log_level, string_output);
         return PyLong_FromLong(0);
     }
 }
diff --git a/src/libdap-python.h b/src/libdap-python.h
index 9b50508..8097c74 100644
--- a/src/libdap-python.h
+++ b/src/libdap-python.h
@@ -17,8 +17,6 @@ static PyObject *dap_set_log_level(PyObject *self, PyObject *args);
 
 static PyObject* dap_log_it(PyObject* self, PyObject* args);
 
-static dap_log_level_t convert_const_char_to_dap_log_level(const char* string);
-
 static PyObject* py_m_dap_config_get_item(PyObject *self, PyObject *args);
 
 static PyObject* py_m_dap_config_get_item_default(PyObject *self, PyObject *args);
-- 
GitLab