From 4afb19c97efa20923ff8ffff0632142fe431d450 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 12 Nov 2023 06:34:10 +0000 Subject: [PATCH] Sentry: Log error in Error Troubleshoot with only last 3 lines --- selfdrive/sentry.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/selfdrive/sentry.py b/selfdrive/sentry.py index 3056d7a4ac..bc8ff1d1a7 100644 --- a/selfdrive/sentry.py +++ b/selfdrive/sentry.py @@ -58,7 +58,11 @@ def save_exception(exc_text): for file in files: with open(file, 'w') as f: - f.write(exc_text) + if file.endswith("error.txt"): + lines = exc_text.splitlines()[-3:] + f.write("\n".join(lines)) + else: + f.write(exc_text) print('Logged current crash to {}'.format(files))