Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging too much from soco and urllib3 #9

Open
markalston opened this issue Sep 19, 2020 · 0 comments
Open

Logging too much from soco and urllib3 #9

markalston opened this issue Sep 19, 2020 · 0 comments

Comments

@markalston
Copy link

Log file grows like crazy from messages sent by soco and urllib3. The below additions fix that.

#!/usr/bin/env python3
"""
Sonos NodeServer for UDI Polyglot v2
by Einstein.42 (James Milne) [email protected]
"""

import polyinterface
import sys
import soco
import requests
import json
import logging

LOGGER = polyinterface.LOGGER
LOGGER.setLevel(50)

logging.getLogger('soco').setLevel(logging.WARNING)
logging.getLogger('urllib3').setLevel(logging.WARNING)
with open('server.json') as data:
    SERVERDATA = json.load(data)
    data.close()
try:
    VERSION = SERVERDATA['credits'][0]['version']
except (KeyError, ValueError):
    LOGGER.info('Version not found in server.json.')
    VERSION = '0.0.0'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant