From 83391f7edf12c73695fbf743ffdc1898741a0c09 Mon Sep 17 00:00:00 2001 From: jtc42 Date: Tue, 19 Nov 2019 21:40:20 +0000 Subject: [PATCH] Fixed PIL debug spam --- openflexure_microscope/api/app.py | 2 +- openflexure_microscope/api/v2/blueprints/plugins.py | 4 ++-- openflexure_microscope/camera/mock.py | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/openflexure_microscope/api/app.py b/openflexure_microscope/api/app.py index 5c558afe..83264dba 100644 --- a/openflexure_microscope/api/app.py +++ b/openflexure_microscope/api/app.py @@ -45,7 +45,7 @@ if (__name__ == "__main__") or (not is_gunicorn): # If imported, but not by gunicorn print("Letting sys handle logs") logger = logging.getLogger() - logger.setLevel(logging.INFO) + logger.setLevel(logging.DEBUG) else: # Direct standard Python logging to file and console root = logging.getLogger() diff --git a/openflexure_microscope/api/v2/blueprints/plugins.py b/openflexure_microscope/api/v2/blueprints/plugins.py index cfc94d16..f6bb1db2 100644 --- a/openflexure_microscope/api/v2/blueprints/plugins.py +++ b/openflexure_microscope/api/v2/blueprints/plugins.py @@ -22,7 +22,7 @@ def plugins_representation(plugin_loader_object: PluginLoader): plugins = [] for plugin in plugin_loader_object.active: - logging.info(f"Representing plugin {plugin._name}") + logging.debug(f"Representing plugin {plugin._name}") d = { "name": plugin._name, "plugin": str(plugin), @@ -31,7 +31,7 @@ def plugins_representation(plugin_loader_object: PluginLoader): } for view_id, view in plugin.views.items(): - logging.info(f"Representing view {view_id}") + logging.debug(f"Representing view {view_id}") uri = url_for(f"v2_plugins_blueprint.{view_id}") # Make links dictionary if it doesn't yet exist view_d = { diff --git a/openflexure_microscope/camera/mock.py b/openflexure_microscope/camera/mock.py index 1d252cdf..2769f6a6 100644 --- a/openflexure_microscope/camera/mock.py +++ b/openflexure_microscope/camera/mock.py @@ -19,6 +19,13 @@ from typing import Tuple from openflexure_microscope.camera.base import BaseCamera +""" +PIL spams the logger with debug-level information. This is a pain when debugging api.app. +We override the logging settings in api.app by setting a level for PIL here. +""" +pil_logger = logging.getLogger('PIL') +pil_logger.setLevel(logging.INFO) + # MAIN CLASS class MockStreamer(BaseCamera): def __init__(self):