Browse Source

Add some logging.

This is difficult to debug in tests.
feature/bike-tracking
Drew Larson 8 years ago
parent
commit
bb69acfbcc
  1. 4
      bikeshop_project/bike/consumers.py

4
bikeshop_project/bike/consumers.py

@ -46,12 +46,16 @@ def check_cpic(message: Dict[str, Union[str, int]]) -> None:
stolen = _is_stolen(message['serial_number']) stolen = _is_stolen(message['serial_number'])
if stolen: if stolen:
logging.info(f'check_epic: CPIC records found the bike with serial number: '
f'{message["serial_number"]} is stolen')
bike.cpic_searched_at = timezone.now() bike.cpic_searched_at = timezone.now()
bike.stolen = True bike.stolen = True
elif stolen is None: elif stolen is None:
logger.error(f'check_epic: Unable to check CPIC records with serial number: {message["serial_number"]}.') logger.error(f'check_epic: Unable to check CPIC records with serial number: {message["serial_number"]}.')
return return
else: else:
logging.info(f'check_epic: CPIC records found the bike with serial number: '
f'{message["serial_number"]} is clear.')
bike.cpic_searched_at = timezone.now() bike.cpic_searched_at = timezone.now()
bike.stolen = False bike.stolen = False

Loading…
Cancel
Save