From ed32fb927c01f0e9a855aea7e88d60b8ce966708 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Fri, 9 Apr 2021 09:26:16 -0400 Subject: [PATCH] Disable logging from imported modules The logging from imported modules (stem, in particular) has caused quite a few users to assume there are errors where there aren't any. The logs from stem also aren't helpful, as everything in the library works as expected despite the implication from the logs that it is not working. --- app/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/__init__.py b/app/__init__.py index f2119f4..164b8e9 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -4,6 +4,7 @@ from app.utils.bangs import gen_bangs_json from flask import Flask from flask_session import Session import json +import logging.config import os from stem import Signal from dotenv import load_dotenv @@ -74,3 +75,9 @@ Session(app) send_tor_signal(Signal.HEARTBEAT) from app import routes # noqa + +# Disable logging from imported modules +logging.config.dictConfig({ + 'version': 1, + 'disable_existing_loggers': True, +})