本文整理汇总了Python中cyclone.web.RequestHandler.flush方法的典型用法代码示例。如果您正苦于以下问题:Python RequestHandler.flush方法的具体用法?Python RequestHandler.flush怎么用?Python RequestHandler.flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cyclone.web.RequestHandler
的用法示例。
在下文中一共展示了RequestHandler.flush方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: flush
# 需要导入模块: from cyclone.web import RequestHandler [as 别名]
# 或者: from cyclone.web.RequestHandler import flush [as 别名]
def flush(self, include_footers=False):
"""
This method is used internally by Cyclone,
Cyclone specify the function on_finish but in that time the request is already flushed,
so overwrite flush() was the easiest way to achieve our collection.
It's here implemented to supports the I/O logging if requested
with the command line options --io $number_of_request_recorded
"""
if hasattr(self, 'globaleaks_io_debug'):
try:
content = ("<" * 15)
content += (" Response %d " % self.globaleaks_io_debug)
content += ("<" * 15) + "\n\n"
content += "status code: " + str(self._status_code) + "\n\n"
content += "headers:\n"
for k, v in self._headers.iteritems():
content += "%s: %s\n" % (k, v)
if self._write_buffer is not None:
content += "\nbody: " + str(self._write_buffer) + "\n"
self.do_verbose_log(content)
except Exception as excep:
log.err("JSON logging fail (flush): %s" % excep.message)
return
RequestHandler.flush(self, include_footers)
示例2: flush
# 需要导入模块: from cyclone.web import RequestHandler [as 别名]
# 或者: from cyclone.web.RequestHandler import flush [as 别名]
def flush(self, include_footers=False):
"""
This method is used internally by Cyclone,
Cyclone specify the function on_finish but in that time the request is already flushed,
so overwrite flush() was the easiest way to achieve our collection.
It's here implemented to supports the I/O logging if requested
with the command line options --io $number_of_request_recorded
"""
from globaleaks.event import outcoming_event_monitored, EventTrack
# This is the event tracker, used to keep track of the
# outcome of the events.
if not hasattr(self, '_status_code'):
if GLSetting.devel_mode:
log.debug("Developer, check this out")
import pdb; pdb.set_trace()
else:
raise Exception("Missing _status_code in some place!")
for event in outcoming_event_monitored:
if event['handler_check'](self.request.uri) and \
event['method'] == self.request.method and \
event['status_checker'](self._status_code):
EventTrack(event, self.request.request_time())
# if event['anomaly_management']:
# event['anomaly_management'](self.request)
if hasattr(self, 'globaleaks_io_debug'):
try:
content = ("<" * 15)
content += (" Response %d " % self.globaleaks_io_debug)
content += ("<" * 15) + "\n\n"
content += "status code: " + str(self._status_code) + "\n\n"
content += "headers:\n"
for k, v in self._headers.iteritems():
content += "%s: %s\n" % (k, v)
if self._write_buffer is not None:
content += "\nbody: " + str(self._write_buffer) + "\n"
self.do_verbose_log(content)
except Exception as excep:
log.err("JSON logging fail (flush): %s" % excep.message)
return
RequestHandler.flush(self, include_footers)