def handle_crash(exc): # todo rework this logging.error('Fatal crash occured') traceback.print_exc() exc.traceback = traceback.format_exc(exc) report_path = '/root/%s-crash.txt' % aj.product try: report = open(report_path, 'w') except: report_path = './%s-crash.txt' % aj.product report = open(report_path, 'w') report.write(make_report(exc)) report.close() logging.error('Crash report written to %s', report_path)
def handle_crash(exc): # todo rework this now = datetime.now().strftime('%Y-%m-%d-%Hh%M') logging.error('Fatal crash occured') traceback.print_exc() exc.traceback = traceback.format_exc() report_path = f'/var/log/ajenti/crash-{now}.txt' try: report = open(report_path, 'w') except Exception as e: report_path = f'./crash-{now}.txt' report = open(report_path, 'w') from aj.util import make_report report.write(make_report(exc)) report.close() logging.error(f'Crash report written to {report_path}') logging.error('Please submit it to https://github.com/ajenti/ajenti/issues/new')