Example #1
0
 def test_log_log_critical(self):
     """Test that log_fatal convenience function logs if enabled."""
     
     with LogCapture() as l:
         event = log_fatal("label", "message", self.user, extra=self.extra)
         m = ('eventlog', 'CRITICAL', "label (user: johndoe) - message {'key2': 'value2', 'key': 'value'}")
         l.check(m)
         event = log_fatal("label", "message", self.user, extra=self.extra, django_log=False)
         l.check(m)
Example #2
0
 def test_convenience_log_fatal(self):
     """Test the log_fatal convenience function."""
     
     event = log_fatal("label", "message", self.user, extra=self.extra)
     self.assertTrue(event.id)
     self.assertEqual(event.label, "label")
     self.assertEqual(event.message, "message")
     self.assertEqual(event.user, self.user)
     self.assertEqual(event.extra, self.extra)
     self.assertEqual(event.level, logging.CRITICAL)