systemd/0079-systemd-python-convert...

28 lines
999 B
Diff

From 044615d3520fe1884b6d1c410b99c26c0b02d41a Mon Sep 17 00:00:00 2001
From: Richard Marko <rmarko@fedoraproject.org>
Date: Tue, 5 Nov 2013 15:41:20 +0100
Subject: [PATCH] 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.
---
src/python-systemd/journal.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py
index d0bcd24..9c7e004 100644
--- a/src/python-systemd/journal.py
+++ b/src/python-systemd/journal.py
@@ -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