ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Blob Blame History Raw
From f9c5cdfe9fe4d3ac8b075ed55d58f79cc067cdae 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