diff --git a/oml/oxtornado.py b/oml/oxtornado.py index d0fde49..db15793 100644 --- a/oml/oxtornado.py +++ b/oml/oxtornado.py @@ -19,6 +19,7 @@ import logging logger = logging.getLogger(__name__) + def json_response(data=None, status=200, text='ok'): if not data: data = {} @@ -76,6 +77,7 @@ def defaultcontext(): @run_async def api_task(context, request, callback): + import settings if context == None: context = defaultcontext action = request.arguments.get('action', [None])[0].decode('utf-8') @@ -89,7 +91,8 @@ def api_task(context, request, callback): 'doc': actions.doc(f).replace('\n', '
\n')}) response = json_response(api) else: - logger.debug('API %s %s', action, data) + if settings.DEBUG_API: + logger.debug('API %s %s', action, data) f = actions.get(action) if f: with context(): diff --git a/oml/settings.py b/oml/settings.py index a750eff..c66722f 100644 --- a/oml/settings.py +++ b/oml/settings.py @@ -87,5 +87,6 @@ VERSION = "%s.%s" % (NODE_PROTOCOL, MINOR_VERSION) USER_AGENT = 'OpenMediaLibrary/%s' % VERSION DEBUG_HTTP = server.get('debug_http', False) +DEBUG_API = server.get('debug_api', False) DB_VERSION = 13