Skip to content

Instantly share code, notes, and snippets.

@jaraco
Last active March 26, 2019 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaraco/b67d91b555768bbd7c4001bdc978ce6a to your computer and use it in GitHub Desktop.
Save jaraco/b67d91b555768bbd7c4001bdc978ce6a to your computer and use it in GitHub Desktop.
import logging
import cherrypy.lib.cpstats
class CherootStatistics(cherrypy.process.plugins.SimplePlugin):
def main(self):
self.bus.log('Enabling Cheroot statistics')
keys = (
key
for key in logging.statistics.keys()
if 'Cheroot HTTPServer' in key
)
logging.statistics[next(keys)]['Enabled'] = True
def main():
CherootStatistics(cherrypy.engine).subscribe()
config = {
'global': {
'server.socket_host': '::0',
},
}
cherrypy.quickstart(cherrypy.lib.cpstats.StatsPage(), config=config)
__name__ == '__main__' and main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment