frontpage: Log a message when loading custom shortcuts

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2019-08-07 14:39:31 -07:00 committed by James Valleroy
parent 063489c036
commit 5caac243a2
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -17,13 +17,17 @@
""" """
Manage application shortcuts on front page. Manage application shortcuts on front page.
""" """
import json import json
import logging
import os import os
from plinth import app, cfg from plinth import app, cfg
from . import actions from . import actions
logger = logging.getLogger(__name__)
class Shortcut(app.FollowerComponent): class Shortcut(app.FollowerComponent):
"""An application component for handling shortcuts.""" """An application component for handling shortcuts."""
@ -173,6 +177,7 @@ def get_custom_shortcuts():
cfg_dir = os.path.dirname(cfg.config_file) cfg_dir = os.path.dirname(cfg.config_file)
shortcuts_file = os.path.join(cfg_dir, 'custom-shortcuts.json') shortcuts_file = os.path.join(cfg_dir, 'custom-shortcuts.json')
if os.path.isfile(shortcuts_file) and os.stat(shortcuts_file).st_size: if os.path.isfile(shortcuts_file) and os.stat(shortcuts_file).st_size:
logger.info('Loading custom shortcuts from %s', shortcuts_file)
with open(shortcuts_file) as shortcuts: with open(shortcuts_file) as shortcuts:
custom_shortcuts = json.load(shortcuts) custom_shortcuts = json.load(shortcuts)
return custom_shortcuts return custom_shortcuts