Suppress requests/urllib3 connection pool log messages (#3854)

requests/urllib3 is notorious for using the INFO log level for very
DEBUG kinds of information. Given the configurability of python
logging it's actually pretty easy to just set requests to WARN by
default. This cleans out a bunch of largely unuseful log lines from
home assistant output.
pull/3928/head
Sean Dague 2016-10-17 15:14:10 -04:00 committed by Johann Kellerman
parent 1540bb1279
commit daea93d9f9
1 changed files with 5 additions and 0 deletions

View File

@ -355,6 +355,11 @@ def enable_logging(hass: core.HomeAssistant, verbose: bool=False,
logging.basicConfig(level=logging.INFO)
fmt = ("%(log_color)s%(asctime)s %(levelname)s (%(threadName)s) "
"[%(name)s] %(message)s%(reset)s")
# suppress overly verbose logs from libraries that aren't helpful
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
try:
from colorlog import ColoredFormatter
logging.getLogger().handlers[0].setFormatter(ColoredFormatter(