From 99c28b583f0766e54d2b31780494dd88769e055d Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 25 Jun 2025 11:42:25 -0700 Subject: [PATCH] actions: Allow logging privileged calls to a server differently Tests: - When a call is made to privileged daemon the log shows network emoji instead of #. - Log for unimplemented calls such as downloading backup images still shows # as they not sent to privileged daemon. Signed-off-by: Sunil Mohan Adapa Reviewed-by: Joseph Nuthalapati --- plinth/actions.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plinth/actions.py b/plinth/actions.py index c0fe5661a..352397546 100644 --- a/plinth/actions.py +++ b/plinth/actions.py @@ -113,7 +113,7 @@ def _run_privileged_method_as_process(func, module_name, action_name, args, proc_kwargs['env'] = {'PYTHONPATH': cfg.file_root} _log_action(func, module_name, action_name, args, kwargs, run_as_user, - run_in_background) + run_in_background, is_server=False) proc = subprocess.Popen(command, **proc_kwargs) os.close(write_fd) @@ -297,9 +297,13 @@ def _get_privileged_action_module_name(func): def _log_action(func, module_name, action_name, args, kwargs, run_as_user, - run_in_background): + run_in_background, is_server): """Log an action in a compact format.""" - prompt = f'({run_as_user})$' if run_as_user else '#' + if is_server: + prompt = 'ยป' + else: + prompt = f'({run_as_user})$' if run_as_user else '#' + suffix = '&' if run_in_background else '' formatted_args = _format_args(func, args, kwargs) logger.info('%s %s..%s(%s) %s', prompt, module_name, action_name,