Exemplo n.º 1
0
 def test_init(self, mock_logging):
     l = Loggable()
     l.set_logger(foo="foo", bar="bat")
     mock_logging.getLogger.assert_called_once_with(
         "malcolm.core.loggable.Loggable.bat.foo")
     filter = l.log.addFilter.call_args[0][0]
     assert filter.fields == dict(foo="foo", bar="bat")
Exemplo n.º 2
0
 def test_init(self, mock_logging):
     loggable = Loggable()
     loggable.set_logger(foo="foo", bar="bat")
     mock_logging.getLogger.assert_called_once_with(
         "malcolm.core.loggable.Loggable.bat.foo")
     assert mock_logging.LoggerAdapter.call_args[1] == {
         "extra": {
             "foo": "foo",
             "bar": "bat"
         }
     }