From 6d6d778a7b041ea772373785b90e2257ec880ae2 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 25 Jul 2018 17:06:09 +0000 Subject: [PATCH] Display log list in chronological order in CLI to avoid having to scroll to get the last action --- src/yunohost/log.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/yunohost/log.py b/src/yunohost/log.py index 5443c6beb..35cd80fe2 100644 --- a/src/yunohost/log.py +++ b/src/yunohost/log.py @@ -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