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-12-08 21:22:33 -05:00
committed by Zbigniew Jędrzejewski-Szmek
parent 7f6c814a70
commit 0ea2d31ba7
+2
View File
@@ -351,6 +351,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