Repository: pozytywnie/webapp-health-monitor

Issue:
Use standard python logging method
Simplify logging by using only build-in logging. Remove forwarding of custom logger class.

Discussion:

Patch:
diff --git a/webapp_health_monitor/verificators/base.py b/webapp_health_monitor/verificators/base.py
index 0f4b6af..668536a 100644
--- a/webapp_health_monitor/verificators/base.py
+++ b/webapp_health_monitor/verificators/base.py
@@ -4,8 +4,8 @@ from webapp_health_monitor import errors
 class Verificator(object):
     verificator_name = None
 
-    def __init__(self, logger):
-        self.logger = logger
+    def __init__(self, **kwargs):
+        pass
 
     def run(self):
         raise NotImplementedError()
@@ -40,7 +40,6 @@ class RangeVerificator(Verificator):
 
     def _check_value(self):
         value = self._get_value()
-        self.logger.check_range(self.lower_bound, value, self.upper_bound)
         self._check_lower_bound(value)
         self._check_upper_bound(value)
 


Test patch:
diff --git a/tests/test_verificators.py b/tests/test_verificators.py
index 84190b2..69c0a96 100644
--- a/tests/test_verificators.py
+++ b/tests/test_verificators.py
@@ -14,55 +14,39 @@ from webapp_health_monitor.verificators.system import (
 
 class RangeVerificatorTest(TestCase):
     def test_lack_of_value_extractor_raises_bad_configuration(self):
-        logger = mock.Mock()
-        verificator = RangeVerificator(logger)
+        verificator = RangeVerificator()
         verificator.lower_bound = 0
         verificator.upper_bound = 0
         self.assertRaises(errors.BadConfigurationError, verificator.run)
 
     def test_lack_of_bounds_raises_bad_configuration(self):
-        logger = mock.Mock()
-        verificator = RangeVerificator(logger)
+        verificator = RangeVerificator()
         verificator.value_extractor = mock.Mock()
         self.assertRaises(errors.BadConfigurationError, verificator.run)
 
     def test_bad_bounds_raises_bad_configuration(self):
-        logger = mock.Mock()
-        verificator = RangeVerificator(logger)
+        verificator = RangeVerificator()
         verificator.value_extractor = mock.Mock()
         verificator.lower_bound = 1
         verificator.upper_bound = 0
         self.assertRaises(errors.BadConfigurationError, verificator.run)
 
     def test_value_below_lower_bound_raises_verification_error(self):
-        logger = mock.Mock()
-        verificator = RangeVerificator(logger)
+        verificator = RangeVerificator()
         verificator._get_value = mock.Mock(return_value=99)
         verificator.value_extractor = mock.Mock()
         verificator.lower_bound = 100
         self.assertRaises(errors.VerificationError, verificator.run)
 
     def test_value_over_upper_bound_raises_verification_error(self):
-        logger = mock.Mock()
-        verificator = RangeVerificator(logger)
+        verificator = RangeVerificator()
         verificator._get_value = mock.Mock(return_value=100)
         verificator.value_extractor = mock.Mock()
         verificator.upper_bound = 99
         self.assertRaises(errors.VerificationError, verificator.run)
 
-    def test_check_logging(self):
-        logger = mock.Mock()
-        verificator = RangeVerificator(logger)
-        verificator._get_value = mock.Mock(return_value=1)
-        verificator.value_extractor = mock.Mock()
-        verificator.lower_bound = 0
-        verificator.upper_bound = 2
-        verificator.run()
-        logger.check_range.assert_called_with(0, 1, 2)
-
     def test_get_value(self):
-        logger = mock.Mock()
-        verificator = RangeVerificator(logger)
+        verificator = RangeVerificator()
         verificator.value_extractor = mock.Mock(
             extract=mock.Mock(return_value=1))
         self.assertEqual(1, verificator._get_value())
@@ -74,8 +58,7 @@ class FreeDiskSpaceVerificatorTest(TestCase):
     def test_using_value_extractor(self, FreeDiskSpaceExtractor):
         class AppVerificator(FreeDiskSpaceVerificator):
             mount_point = '/home'
-        logger = mock.Mock()
-        verificator = AppVerificator(logger)
+        verificator = AppVerificator()
         FreeDiskSpaceExtractor.return_value.extract.return_value = 100
         self.assertEqual(100, verificator._get_value())
         FreeDiskSpaceExtractor.assert_called_with('/home')
@@ -87,8 +70,7 @@ class PercentUsedDiskSpaceVerificatorTest(TestCase):
     def test_using_value_extractor(self, PercentUsedDiskSpaceExtractor):
         class AppVerificator(PercentUsedDiskSpaceVerificator):
             mount_point = '/home'
-        logger = mock.Mock()
-        verificator = AppVerificator(logger)
+        verificator = AppVerificator()
         PercentUsedDiskSpaceExtractor.return_value.extract.return_value = 100
         self.assertEqual(100, verificator._get_value())
         PercentUsedDiskSpaceExtractor.assert_called_with('/home')