Skip to content

Commit

Permalink
Actually do logging correctly.
Browse files Browse the repository at this point in the history
Use the logger not just the root logger.
  • Loading branch information
JBassett authored Nov 17, 2019
1 parent 0236842 commit 51dcf8d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions custom_components/plex_webhooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

async def handle_webhook(hass, webhook_id, request):
"""Handle webhook callback."""
logging.debug('Got plex webhook.')
_LOGGER.debug('Got plex webhook.')

data = {}

Expand All @@ -43,7 +43,7 @@ async def handle_webhook(hass, webhook_id, request):
if part.name == 'payload':
data = await part.json()
except ValueError:
logging.warn('Issue decoding webhook: ' + part.text())
_LOGGER.warn('Issue decoding webhook: ' + part.text())
return None

event = data['event']
Expand All @@ -56,21 +56,21 @@ async def handle_webhook(hass, webhook_id, request):
grabbed = ['library.new']

if event in playing:
logging.debug('Plex started playing')
_LOGGER.debug('Plex started playing')
data['status'] = 'PLAYING'
data['playerUuid'] = data['Player']['uuid']
elif event in stopped:
logging.debug('Plex stopped playing')
_LOGGER.debug('Plex stopped playing')
data['status'] = 'STOPPED'
data['playerUuid'] = data['Player']['uuid']
elif event in grabbed:
logging.debug('Plex got new media')
_LOGGER.debug('Plex got new media')
data['status'] = 'GRABBED'

hass.bus.async_fire(EVENT_RECEIVED, data)

async def async_setup(hass, config):
logging.debug('Initing Plex Webhooks!')
_LOGGER.debug('Initing Plex Webhooks!')
webhook_id = config[DOMAIN][CONF_WEBHOOK_ID]
hass.components.webhook.async_register(
DOMAIN, "Plex", webhook_id, handle_webhook
Expand Down

0 comments on commit 51dcf8d

Please sign in to comment.