diff --git a/lifemonitor/redis.py b/lifemonitor/redis.py index 29e4453b..8bb3ae8d 100644 --- a/lifemonitor/redis.py +++ b/lifemonitor/redis.py @@ -18,6 +18,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import logging + +import redis_lock from flask import Flask from redis import Redis @@ -37,4 +40,17 @@ def init(app: Flask) -> Redis: port=int(app.config.get("REDIS_PORT_NUMBER", 6379)), password=app.config.get("REDIS_PASSWORD", "foobar"), db=0) + + # reconfigure the logging level for the redis_lock library + redis_lock_logger_level = logging.WARNING + if app.config.get("DEBUG", False): + redis_lock_logger_level = logging.DEBUG + redis_lock.logger_for_acquire.setLevel(redis_lock_logger_level) + redis_lock.logger_for_release.setLevel(redis_lock_logger_level) + redis_lock.logger_for_acquire.setLevel(redis_lock_logger_level) + redis_lock.logger_for_refresh_thread.setLevel(redis_lock_logger_level) + redis_lock.logger_for_refresh_start.setLevel(redis_lock_logger_level) + redis_lock.logger_for_refresh_shutdown.setLevel(redis_lock_logger_level) + redis_lock.logger_for_refresh_exit.setLevel(redis_lock_logger_level) + redis_lock.logger_for_release.setLevel(redis_lock_logger_level) return __redis__