WSGI Application Profiler

Warning

werkzeug.contrib.profiler has moved to werkzeug.middleware.profiler. The old import is deprecated as of version 0.15 and will be removed in version 1.0.

class werkzeug.contrib.profiler.MergeStream(*streams)

An object that redirects write calls to multiple streams. Use this to log to both sys.stdout and a file:

f = open('profiler.log', 'w')
stream = MergeStream(sys.stdout, f)
profiler = ProfilerMiddleware(app, stream)