comparison foodtruck/pubutil.py @ 776:3799621cd25b

admin: Correctly flush loggers before exiting.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 04 Jul 2016 00:16:26 -0700
parents 3885421c29a3
children
comparison
equal deleted inserted replaced
775:ba0a6bd5e913 776:3799621cd25b
16 if (not is_app_debug or 16 if (not is_app_debug or
17 os.environ.get('WERKZEUG_RUN_MAIN') == 'true'): 17 os.environ.get('WERKZEUG_RUN_MAIN') == 'true'):
18 # This is needed when hitting CTRL+C to shutdown the Werkzeug server, 18 # This is needed when hitting CTRL+C to shutdown the Werkzeug server,
19 # otherwise SSE generators will keep it alive. 19 # otherwise SSE generators will keep it alive.
20 logger.debug("Shutting down SSE generators...") 20 logger.debug("Shutting down SSE generators...")
21 logger.flush() 21 for h in logger.handlers:
22 h.flush()
22 global server_shutdown 23 global server_shutdown
23 server_shutdown = True 24 server_shutdown = True
24 raise KeyboardInterrupt() 25 raise KeyboardInterrupt()
25 26
26 27