mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	dev-proxy-logging: Disable dev proxy logging by default.
- Add parameter to proxy launchig script, which enables logging for dev proxy server (disabled by default).
This commit is contained in:
		@@ -62,6 +62,10 @@ parser.add_option('--force', dest='force',
 | 
			
		||||
                  action="store_true",
 | 
			
		||||
                  default=False, help='Run tests despite possible problems.')
 | 
			
		||||
 | 
			
		||||
parser.add_option('--enable-tornado-logging', dest='enable_tornado_logging',
 | 
			
		||||
                  action="store_true",
 | 
			
		||||
                  default=False, help='Enable access logs from tornado proxy server.')
 | 
			
		||||
 | 
			
		||||
(options, arguments) = parser.parse_args()
 | 
			
		||||
 | 
			
		||||
if not options.force:
 | 
			
		||||
@@ -325,8 +329,8 @@ class TornadoHandler(CombineHandler):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Application(web.Application):
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        # type: () -> None
 | 
			
		||||
    def __init__(self, enable_logging=False):
 | 
			
		||||
        # type: (bool) -> None
 | 
			
		||||
        handlers = [
 | 
			
		||||
            (r"/json/events.*", TornadoHandler),
 | 
			
		||||
            (r"/api/v1/events.*", TornadoHandler),
 | 
			
		||||
@@ -335,7 +339,12 @@ class Application(web.Application):
 | 
			
		||||
            (r"/socket.io.*", WebPackHandler),
 | 
			
		||||
            (r"/.*", DjangoHandler)
 | 
			
		||||
        ]
 | 
			
		||||
        super(Application, self).__init__(handlers)
 | 
			
		||||
        super(Application, self).__init__(handlers, enable_logging=enable_logging)
 | 
			
		||||
 | 
			
		||||
    def log_request(self, handler):
 | 
			
		||||
        # type: (BaseWebsocketHandler) -> None
 | 
			
		||||
        if self.settings['enable_logging']:
 | 
			
		||||
            super(Application, self).log_request(handler)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def on_shutdown():
 | 
			
		||||
@@ -364,7 +373,7 @@ print("".join((WARNING,
 | 
			
		||||
                   proxy_port), ENDC)))
 | 
			
		||||
 | 
			
		||||
try:
 | 
			
		||||
    app = Application()
 | 
			
		||||
    app = Application(enable_logging=options.enable_tornado_logging)
 | 
			
		||||
    app.listen(proxy_port, address=options.interface)
 | 
			
		||||
    ioloop = IOLoop.instance()
 | 
			
		||||
    for s in (signal.SIGINT, signal.SIGTERM):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user