summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/reporting/handlers.py2
-rw-r--r--tests/unittests/test_reporting.py6
2 files changed, 4 insertions, 4 deletions
diff --git a/cloudinit/reporting/handlers.py b/cloudinit/reporting/handlers.py
index 1343311f..172679cc 100644
--- a/cloudinit/reporting/handlers.py
+++ b/cloudinit/reporting/handlers.py
@@ -35,7 +35,7 @@ class LogHandler(ReportingHandler):
else:
input_level = level
try:
- level = gettattr(logging, level.upper())
+ level = getattr(logging, level.upper())
except:
LOG.warn("invalid level '%s', using WARN", input_level)
level = logging.WARN
diff --git a/tests/unittests/test_reporting.py b/tests/unittests/test_reporting.py
index 1a4ee8c4..66d4e87e 100644
--- a/tests/unittests/test_reporting.py
+++ b/tests/unittests/test_reporting.py
@@ -137,14 +137,14 @@ class TestLogHandler(TestCase):
def test_single_log_message_at_info_published(self, getLogger):
event = reporting.ReportingEvent('type', 'name', 'description')
reporting.handlers.LogHandler().publish_event(event)
- self.assertEqual(1, getLogger.return_value.info.call_count)
+ self.assertEqual(1, getLogger.return_value.log.call_count)
@mock.patch.object(reporting.handlers.logging, 'getLogger')
def test_log_message_uses_event_as_string(self, getLogger):
event = reporting.ReportingEvent('type', 'name', 'description')
- reporting.handlers.LogHandler().publish_event(event)
+ reporting.handlers.LogHandler(level="INFO").publish_event(event)
self.assertIn(event.as_string(),
- getLogger.return_value.info.call_args[0][0])
+ getLogger.return_value.log.call_args[0][1])
class TestDefaultRegisteredHandler(TestCase):