def test_logger_logs_error_as_object(self):
     try:
         raise 'error-string'
     except Exception as error:
         logger.log(level='ERROR',
                    log={
                        'error': repr(error),
                        'request': 'request'
                    },
                    trace=True)
示例#2
0
 def _set_error(self, code, key_path, message, error=None):
     self.router_response.code = code
     self.router_response.set_error(key_path, message)
     if error and not os.getenv('UNITTEST'):
         logger.log(level='ERROR', log=error, trace=True)
     raise Exception(message)
 def test_logger_logs_simple(self):
     logger.log(level='ERROR', log={'error': 'test-simple'}, trace=True)
 def test_logger_logs_see_info_numeric(self):
     logger.log(level='INFO', log={'INFO': 'see-numeric'}, trace=True)
 def test_logger_logs_see_info(self):
     logger.log(level='INFO', log={'INFO': 'see'}, trace=True)
 def test_logger_logs_ignore_info(self):
     logger.log(level='INFO', log={'INFO': 'ignore'}, trace=True)
 def test_logger_logs_error(self):
     try:
         raise Exception('error-object')
     except Exception as error:
         logger.log(level='ERROR', log=repr(error), trace=True)