Display log list in chronological order in CLI to avoid having to scroll to get the last action

This commit is contained in:
Alexandre Aubin 2018-07-25 17:06:09 +00:00
parent f89c41f3e4
commit 6d6d778a7b

View file

@ -57,10 +57,10 @@ def log_list(category=[], limit=None):
"""
categories = category
is_api = msettings.get('interface') == 'api'
# In cli we just display `operation` logs by default
if not categories:
is_api = msettings.get('interface') == 'api'
categories = ["operation"] if not is_api else CATEGORIES
result = collections.OrderedDict()
@ -101,6 +101,11 @@ def log_list(category=[], limit=None):
result[category].append(entry)
# Reverse the order of log when in cli, more comfortable to read (avoid unecessary scrolling)
if not is_api:
for category in result:
result[category] = list(reversed(result[category]))
return result