wsgi日志和事件报告中间件
wsgilog的Python项目详细描述
支持将wsgi应用程序中的事件记录到 标准输出、时间轮换日志文件、电子邮件、系统日志和Web服务器。阿尔索 支持捕获HTML格式的异常回溯并将其发送到 用于调试的Web浏览器。
简单用法示例:
from wsgilog import log @log(tohtml=True, tofile='wsgi.log', tostream=True, toprint=True) def app(environ, start_response): print 'STDOUT is logged.' environ['wsgilog.logger'].info('This information is logged.') # Exception will be logged and sent to the browser formatted as HTML. raise Exception() if __name__ == '__main__': from wsgiref.simple_server import make_server http = make_server('', 8080, app) http.serve_forever()