mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
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:
parent
fadea7eb4a
commit
0ab9be2ae0
@ -95,7 +95,8 @@ def action_init(console: bool = False):
|
|||||||
"""Initialize logging for action scripts."""
|
"""Initialize logging for action scripts."""
|
||||||
_capture_warnings()
|
_capture_warnings()
|
||||||
|
|
||||||
configuration = get_configuration()
|
configuration = get_configuration(
|
||||||
|
syslog_identifier='freedombox-privileged')
|
||||||
if console:
|
if console:
|
||||||
configuration['root']['handlers'] = ['console']
|
configuration['root']['handlers'] = ['console']
|
||||||
else:
|
else:
|
||||||
@ -125,7 +126,7 @@ def setup_cherrypy_static_directory(app):
|
|||||||
app.log.error_log.propagate = False
|
app.log.error_log.propagate = False
|
||||||
|
|
||||||
|
|
||||||
def get_configuration():
|
def get_configuration(syslog_identifier='freedombox'):
|
||||||
"""Return the main python logging module configuration."""
|
"""Return the main python logging module configuration."""
|
||||||
configuration = {
|
configuration = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
@ -143,7 +144,8 @@ def get_configuration():
|
|||||||
'formatter': 'color'
|
'formatter': 'color'
|
||||||
},
|
},
|
||||||
'journal': {
|
'journal': {
|
||||||
'class': 'systemd.journal.JournalHandler'
|
'class': 'systemd.journal.JournalHandler',
|
||||||
|
'SYSLOG_IDENTIFIER': syslog_identifier,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'root': {
|
'root': {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user