Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

Commit

Permalink
Optimize logging levels for app
Browse files Browse the repository at this point in the history
  • Loading branch information
HACKERMD committed Nov 18, 2016
1 parent 218b3ed commit f813d8e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tmserver/appfactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,26 @@ def create_app(config_overrides={}, verbosity=None):
werkzeug_logger = logging.getLogger('werkzeug')
werkzeug_logger.addHandler(file_handler)
werkzeug_logger.addHandler(stdout_handler)
if verbosity > 4:
if verbosity > 5:
gc3pie_logger.setLevel(logging.DEBUG)
wsgi_logger.setLevel(logging.DEBUG)
werkzeug_logger.setLevel(logging.DEBUG)
apscheduler_logger.setLevel(logging.DEBUG)
elif verbosity > 3:
elif verbosity > 4:
gc3pie_logger.setLevel(logging.INFO)
wsgi_logger.setLevel(logging.DEBUG)
werkzeug_logger.setLevel(logging.DEBUG)
apscheduler_logger.setLevel(logging.DEBUG)
elif verbosity > 3:
gc3pie_logger.setLevel(logging.ERROR)
wsgi_logger.setLevel(logging.INFO)
werkzeug_logger.setLevel(logging.INFO)
apscheduler_logger.setLevel(logging.INFO)
else:
gc3pie_logger.setLevel(logging.CRITICAL)
wsgi_logger.setLevel(logging.CRITICAL)
werkzeug_logger.setLevel(logging.CRITICAL)
apscheduler_logger.setLevel(logging.CRITICAL)
wsgi_logger.setLevel(logging.ERROR)
werkzeug_logger.setLevel(logging.ERROR)
apscheduler_logger.setLevel(logging.ERROR)

## Set the JSON encoder
app.json_encoder = TmJSONEncoder
Expand Down

0 comments on commit f813d8e

Please sign in to comment.