[systemd-devel] [PATCH] systemd-python: convert keyword value to string

rmarko at redhat.com rmarko at redhat.com
Tue Nov 5 06:41:20 PST 2013


From: Richard Marko <rmarko at fedoraproject.org>

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.

Signed-off-by: Richard Marko <rmarko at fedoraproject.org>
---
 src/python-systemd/journal.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py
index d0bcd24..64b0fa8 100644
--- a/src/python-systemd/journal.py
+++ b/src/python-systemd/journal.py
@@ -353,7 +353,7 @@ def _make_line(field, value):
         if isinstance(value, bytes):
                 return field.encode('utf-8') + b'=' + value
         else:
-                return field + '=' + value
+                return field + '=' + str(value)
 
 def send(MESSAGE, MESSAGE_ID=None,
          CODE_FILE=None, CODE_LINE=None, CODE_FUNC=None,
-- 
1.8.4.2



More information about the systemd-devel mailing list