PageRenderTime 615ms CodeModel.GetById 37ms RepoModel.GetById 0ms app.codeStats 0ms

/torn/application.py

https://github.com/nixon/torn
Python | 25 lines | 16 code | 3 blank | 6 comment | 6 complexity | ed6313903f98b0ccb1a360244d3bd178 MD5 | raw file
  1. from tornado.web import Application as TornadoApp
  2. import logging
  3. class Application(TornadoApp):
  4. """ Simply reserving the right to override aspects
  5. of the base Application class at another point, and
  6. set the basic logger level until we find a better
  7. way.
  8. """
  9. def __init__(self, *args, **kwargs):
  10. # There HAS to be a better way to do this...
  11. loglevel = kwargs.get('loglevel')
  12. if loglevel and loglevel != "none":
  13. base_logger = logging.getLogger()
  14. if loglevel == "debug":
  15. base_logger.setLevel(logging.DEBUG)
  16. elif loglevel == "info":
  17. base_logger.setLevel(logging.INFO)
  18. elif loglevel == "warning":
  19. base_logger.setLevel(logging.WARNING)
  20. elif loglevel == "error":
  21. base_logger.setLevel(logging.ERROR)
  22. super(type(self), self).__init__(*args, **kwargs)