diff --git a/calibre-plugin/__init__.py b/calibre-plugin/__init__.py index 148b9eea..106d2040 100644 --- a/calibre-plugin/__init__.py +++ b/calibre-plugin/__init__.py @@ -7,15 +7,21 @@ __license__ = 'GPL v3' __copyright__ = '2016, Jim Miller' __docformat__ = 'restructuredtext en' -import sys +import sys, os if sys.version_info >= (2, 7): import logging logger = logging.getLogger(__name__) loghandler=logging.StreamHandler() loghandler.setFormatter(logging.Formatter("FFF: %(levelname)s: %(asctime)s: %(filename)s(%(lineno)d): %(message)s")) logger.addHandler(loghandler) - loghandler.setLevel(logging.DEBUG) - logger.setLevel(logging.DEBUG) + + from calibre.constants import DEBUG + if os.environ.get('CALIBRE_WORKER', None) is not None or DEBUG: + loghandler.setLevel(logging.DEBUG) + logger.setLevel(logging.DEBUG) + else: + loghandler.setLevel(logging.CRITICAL) + logger.setLevel(logging.CRITICAL) # pulls in translation files for _() strings try: