Commit 2826df63 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[trac756] Effective debug level

parent 3cf7f4bf
......@@ -263,9 +263,9 @@ Logger_getEffectiveSeverity(LoggerWrapper* self, PyObject*) {
}
PyObject*
Logger_getDebugLevel(LoggerWrapper* self, PyObject*) {
Logger_getEffectiveDebugLevel(LoggerWrapper* self, PyObject*) {
try {
return (Py_BuildValue("i", self->logger_->getDebugLevel()));
return (Py_BuildValue("i", self->logger_->getEffectiveDebugLevel()));
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_RuntimeError, e.what());
......@@ -504,7 +504,8 @@ PyMethodDef loggerMethods[] = {
{ "get_effective_severity",
reinterpret_cast<PyCFunction>(Logger_getEffectiveSeverity),
METH_NOARGS, "Returns the effective logging severity as string" },
{ "get_debug_level", reinterpret_cast<PyCFunction>(Logger_getDebugLevel),
{ "get_effective_debug_level",
reinterpret_cast<PyCFunction>(Logger_getEffectiveDebugLevel),
METH_NOARGS, "Returns the current debug level." },
{ "set_severity",
reinterpret_cast<PyCFunction>(Logger_setSeverity), METH_VARARGS,
......
......@@ -63,7 +63,7 @@ class Logger(unittest.TestCase):
# Checks defaults of the logger
def defaults(self, logger):
self.assertEqual(logger.get_effective_severity(), "DEBUG")
self.assertEqual(logger.get_debug_level(), 0)
self.assertEqual(logger.get_effective_debug_level(), 50)
def test_default_severity(self):
logger = isc.log.Logger("child")
......@@ -74,11 +74,11 @@ class Logger(unittest.TestCase):
logger = isc.log.Logger("child")
logger.set_severity('DEBUG', 25)
self.assertEqual(logger.get_effective_severity(), "DEBUG")
self.assertEqual(logger.get_debug_level(), 25)
self.assertEqual(logger.get_effective_debug_level(), 25)
for sev in self.sevs:
logger.set_severity(sev)
self.assertEqual(logger.get_effective_severity(), sev)
self.assertEqual(logger.get_debug_level(), 0)
self.assertEqual(logger.get_effective_debug_level(), 0)
# Return to default
logger.set_severity(None)
self.defaults(logger)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment