log: Set simpler syslog identifier instead of full binary path

Tests:

- When watching journal using 'sudo freedombox-logs' command, the syslog
identifier for main service is 'freedombox' and for privileged service is
'freedombox-privileged'.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2026-07-22 19:58:32 -07:00 committed by James Valleroy
parent fadea7eb4a
commit 0ab9be2ae0
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -95,7 +95,8 @@ def action_init(console: bool = False):
"""Initialize logging for action scripts."""
_capture_warnings()
configuration = get_configuration()
configuration = get_configuration(
syslog_identifier='freedombox-privileged')
if console:
configuration['root']['handlers'] = ['console']
else:
@ -125,7 +126,7 @@ def setup_cherrypy_static_directory(app):
app.log.error_log.propagate = False
def get_configuration():
def get_configuration(syslog_identifier='freedombox'):
"""Return the main python logging module configuration."""
configuration = {
'version': 1,
@ -143,7 +144,8 @@ def get_configuration():
'formatter': 'color'
},
'journal': {
'class': 'systemd.journal.JournalHandler'
'class': 'systemd.journal.JournalHandler',
'SYSLOG_IDENTIFIER': syslog_identifier,
}
},
'root': {