From f89c41f3e472b13e9b51e31024e2465a546d17d9 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 25 Jul 2018 16:38:53 +0000 Subject: [PATCH] Improve behavior of yunopaste() for integration with the webadmin --- locales/en.json | 1 + src/yunohost/log.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/locales/en.json b/locales/en.json index c6310f6fb..52e102af4 100644 --- a/locales/en.json +++ b/locales/en.json @@ -225,6 +225,7 @@ "log_app_remove": "Remove '{}' application", "log_app_upgrade": "Upgrade '{}' application", "log_app_makedefault": "Make '{}' as default application", + "log_available_on_yunopaste": "This log is now available via {url}", "log_backup_restore_system": "Restore system from a backup archive", "log_backup_restore_app": "Restore '{}' from a backup archive", "log_remove_on_failed_restore": "Remove '{}' after a failed restore from a backup archive", diff --git a/src/yunohost/log.py b/src/yunohost/log.py index f079a3894..5443c6beb 100644 --- a/src/yunohost/log.py +++ b/src/yunohost/log.py @@ -158,7 +158,13 @@ def log_display(path, number=50, share=False): if os.path.exists(log_path): content += read_file(log_path) - return yunopaste(content) + url = yunopaste(content) + + logger.info(m18n.n("log_available_on_yunopaste", url=url)) + if msettings.get('interface') == 'api': + return { "url" : url } + else: + return # Display metadata if exist if os.path.exists(md_path):