updated details in pushbullet logging

pull/8/head
Chris Caron 2018-02-25 20:44:10 -05:00
parent 0c0449fc70
commit 70bdb947de
1 changed files with 11 additions and 5 deletions

View File

@ -128,29 +128,35 @@ class NotifyPushBullet(NotifyBase):
auth=auth, auth=auth,
verify=self.verify_certificate, verify=self.verify_certificate,
) )
if r.status_code != requests.codes.ok: if r.status_code != requests.codes.ok:
# We had a problem # We had a problem
try: try:
self.logger.warning( self.logger.warning(
'Failed to send PushBullet notification: ' 'Failed to send PushBullet notification to '
'%s (error=%s).' % ( '"%s": %s (error=%s).' % (
recipient,
PUSHBULLET_HTTP_ERROR_MAP[r.status_code], PUSHBULLET_HTTP_ERROR_MAP[r.status_code],
r.status_code)) r.status_code))
except KeyError: except KeyError:
self.logger.warning( self.logger.warning(
'Failed to send PushBullet notification ' 'Failed to send PushBullet notification to '
'(error=%s).' % r.status_code) '"%s" (error=%s).' % (recipient, r.status_code))
# self.logger.debug('Response Details: %s' % r.raw.read()) # self.logger.debug('Response Details: %s' % r.raw.read())
# Return; we're done # Return; we're done
has_error = True has_error = True
else:
self.logger.info(
'Sent PushBullet notification to "%s".' % (recipient))
except requests.RequestException as e: except requests.RequestException as e:
self.logger.warning( self.logger.warning(
'A Connection error occured sending PushBullet ' 'A Connection error occured sending PushBullet '
'notification.' 'notification to "%s".' % (recipient),
) )
self.logger.debug('Socket Exception: %s' % str(e)) self.logger.debug('Socket Exception: %s' % str(e))
has_error = True has_error = True