mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix dump_script_log_extract_for_debugging : We want to catch the last exit in the logs, not the first one.
This commit is contained in:
parent
5a08206837
commit
0a5bf3d021
1 changed files with 12 additions and 4 deletions
|
@ -753,8 +753,16 @@ class OperationLogger(object):
|
|||
filters = [re.compile(f_) for f_ in filters]
|
||||
|
||||
lines_to_display = []
|
||||
for line in lines:
|
||||
|
||||
# The logs may contain multiple ynh_exit_properly (backup + upgrade e.g)
|
||||
# We want to get the last one.
|
||||
rev_lines = reversed(lines)
|
||||
for line in rev_lines:
|
||||
if line.endswith("+ ynh_exit_properly") or " + ynh_die " in line:
|
||||
lines_to_display.append(line)
|
||||
break
|
||||
|
||||
for line in rev_lines:
|
||||
if ": " not in line.strip():
|
||||
continue
|
||||
|
||||
|
@ -768,10 +776,10 @@ class OperationLogger(object):
|
|||
|
||||
lines_to_display.append(line)
|
||||
|
||||
if line.endswith("+ ynh_exit_properly") or " + ynh_die " in line:
|
||||
if len(lines_to_display) > 20:
|
||||
break
|
||||
elif len(lines_to_display) > 20:
|
||||
lines_to_display.pop(0)
|
||||
|
||||
lines_to_display.reverse()
|
||||
|
||||
logger.warning(
|
||||
"Here's an extract of the logs before the crash. It might help debugging the error:"
|
||||
|
|
Loading…
Add table
Reference in a new issue