/torn/application.py

https://github.com/joshmarshall/torn
Python | 18 lines | 10 code | 2 blank | 6 comment | 2 complexity | 11a773dfc9f71cbd41aeae3bbef2cb59 MD5 | raw file
  1. from tornado.web import Application as TornadoApp
  2. from util import setLoggerLevel
  3. import logging
  4. class Application(TornadoApp):
  5. """ Simply reserving the right to override aspects
  6. of the base Application class at another point, and
  7. set the basic logger level until we find a better
  8. way.
  9. """
  10. def __init__(self, *args, **kwargs):
  11. # set logger level if provided
  12. loglevel = kwargs.get('loglevel')
  13. if loglevel and loglevel != "none":
  14. base_logger = logging.getLogger()
  15. setLoggerLevel(base_logger, loglevel)
  16. super(type(self), self).__init__(*args, **kwargs)