From 437cceb51f8c9ed2c69cb76a42471b9456029dee Mon Sep 17 00:00:00 2001 From: Alexey Stratulat <alexey.stratulat@demlabs.net> Date: Wed, 28 Aug 2019 22:10:29 +0700 Subject: [PATCH] [+] Added the ability to set the registration level. Using words and not numbers. Changed the Unit test so that he would also use this function. --- src/python-cellframe.c | 9 +++++++++ test/main_test.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/python-cellframe.c b/src/python-cellframe.c index dc45a50e..9034755e 100644 --- a/src/python-cellframe.c +++ b/src/python-cellframe.c @@ -9,6 +9,15 @@ PyMODINIT_FUNC PyInit_libCellFrame(void){ CellFrame_error = PyErr_NewException("libCellFrame.error", NULL, NULL); PyModule_AddObject(module, "error", CellFrame_error); + PyModule_AddObject(module, "DEBUG", PyLong_FromLong(L_DEBUG)); + PyModule_AddObject(module, "INFO", PyLong_FromLong(L_INFO)); + PyModule_AddObject(module, "NOTICE", PyLong_FromLong(L_NOTICE)); + PyModule_AddObject(module, "MESSAGE", PyLong_FromLong(L_MSG)); + PyModule_AddObject(module, "DAP", PyLong_FromLong(L_DAP)); + PyModule_AddObject(module, "WARNING", PyLong_FromLong(L_WARNING)); + PyModule_AddObject(module, "ATT", PyLong_FromLong(L_ATT)); + PyModule_AddObject(module, "ERROR", PyLong_FromLong(L_ERROR)); + PyModule_AddObject(module, "CRITICAL", PyLong_FromLong(L_CRITICAL)); //PyModule_AddObject(module, "Dap", (PyObject*)&DapObject_DapObjectType); return module; diff --git a/test/main_test.py b/test/main_test.py index b4f9ede7..762d68ea 100644 --- a/test/main_test.py +++ b/test/main_test.py @@ -25,7 +25,7 @@ json_string = """{ init(json_string) logItInfo("Initialization of the DAP done") -setLogLevel(0) +setLogLevel(DEBUG) logItInfo("Level logging ""DEBUG"" done") logItInfo( "Test. Outputting a string using the log_it function in the libdap library") logItInfo("Outputting a string using the log_it function done") -- GitLab