[systemd-devel] [RFC PATCH] systemd-python: add SYSLOG_IDENTIFIER to JournalHandler

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Mon Apr 22 14:15:45 PDT 2013


On Mon, Apr 22, 2013 at 09:53:55PM +0100, Steven Hiscocks wrote:
> >+                self._SYSLOG_IDENTIFIER = (_sys.argv[0]
> >+                                           if SYSLOG_IDENTIFIER is None
> >+                                           else SYSLOG_IDENTIFIER)
> >
> How about having the value as `__name__`, but`_sys.argv[0]` if
> `__name__ == "__main__`?
__name__ would always be 'journal'. We could use __main__.__name__,
but I don't think it makes much of a difference, since it is set
from sys.argv[0] anyway. And there's one case where it's less useful:
when __name__ == '__main__'. Current code will use SYSLOG_IDENTIFIER='',
and journald will add SYSLOG_IDENTIFIER=python on it's own, which
looks OK.

Zbyszek


More information about the systemd-devel mailing list