systemd-python: convert keyword value to string

Allows using journal.send('msg', PRIORITY=journal.LOG_CRIT)

Before this commit this results in
TypeError: cannot concatenate 'str' and 'int' objects
and requires passing PRIORITY value as string to work.
This commit is contained in:
Richard Marko 2013-11-05 15:41:20 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent 889a90422d
commit 8ff8ee8373

View file

@ -352,6 +352,8 @@ def get_catalog(mid):
def _make_line(field, value):
if isinstance(value, bytes):
return field.encode('utf-8') + b'=' + value
elif isinstance(value, int):
return field + '=' + str(value)
else:
return field + '=' + value