mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
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 <sunil@medhas.org> Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
parent
847de4d570
commit
99c28b583f
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user