1
0
Fork 0
forked from s3lph/matemat

Added log output to cron job runner.

This commit is contained in:
s3lph 2018-09-09 04:03:51 +02:00
parent 270910f6be
commit b55ad25f58

View file

@ -321,9 +321,13 @@ class MatematWebserver(object):
def _cron_runner(self, fun: Callable[[Dict[str, str], jinja2.Environment, logging.Logger], None]): def _cron_runner(self, fun: Callable[[Dict[str, str], jinja2.Environment, logging.Logger], None]):
self._httpd.logger.info('Executing cron job "%s"', fun.__name__) self._httpd.logger.info('Executing cron job "%s"', fun.__name__)
fun(self._httpd.pagelet_variables, try:
self._httpd.jinja_env, fun(self._httpd.pagelet_variables,
self._httpd.logger) self._httpd.jinja_env,
self._httpd.logger)
self._httpd.logger.info('Completed cron job "%s"', fun.__name__)
except BaseException as e:
self._httpd.logger.exception('Cron job "%s" failed:', fun.__name__, exc_info=e)
class HttpHandler(BaseHTTPRequestHandler): class HttpHandler(BaseHTTPRequestHandler):