code: def log_coroutine_exceptions(coro):
      
      def log_cb(self, f):
          try:
              f.result()
          except Exception:
              self._logger.exception('Unhandled exception calling coroutine {0!r}'
                                     .format(coro))
  
      @wraps(coro)
      def wrapped_coro(self, *args, **kwargs):
          try:
              f = coro(self, *args, **kwargs)
          except Exception:
              f = tornado_Future()
              f.set_exc_info(sys.exc_info())
          f.add_done_callback(partial(log_cb, self))
          return f
  
      return wrapped_coro
docs: Coroutine (or any method that returns a future) decorator to log exceptions
  
      Example
      -------
  
      ::
  
      import logging
  
      class A(object):
          _logger = logging.getLogger(__name__)
  
          @log_coroutine_exceptions
          @tornado.gen.coroutine
          def raiser(self, arg):
              yield tornado.gen.moment
              raise Exception(arg)
  
      Assuming that your object (self) has a `_logger` attribute containing a
      logger instance