summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Hiscocks <steven@hiscocks.me.uk>2013-02-17 17:46:01 +0000
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-07-05 14:19:16 -0400
commitd21d05648df0093f77363fe891bdb2cc11d036e0 (patch)
tree642ee708326329b07357905dac00d93c7175a3cc
parent82ff2498de678de19076bb3f3cf34de210164c0f (diff)
downloadpython-systemd-d21d05648df0093f77363fe891bdb2cc11d036e0.tar.gz
systemd-python: add Journal method to add MESSAGE_ID match
-rw-r--r--systemd/journal.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/systemd/journal.py b/systemd/journal.py
index 4f42928..d61c30e 100644
--- a/systemd/journal.py
+++ b/systemd/journal.py
@@ -183,6 +183,15 @@ class Journal(_Journal):
else:
raise ValueError("Log level must be 0 <= level <= 7")
+ def messageid_match(self, messageid):
+ """Sets match filter for log entries for specified `messageid`.
+ `messageid` can be string or UUID instance.
+ Standard message IDs can be found in systemd.id128
+ Equivalent to add_match(MESSAGE_ID=`messageid`)."""
+ if isinstance(messageid, _uuid.UUID):
+ messageid = messageid.get_hex()
+ self.add_match(MESSAGE_ID=messageid)
+
def this_boot(self, bootid=None):
"""Add match for _BOOT_ID equal to current boot ID or the specified boot ID.