diff options
| author | Steven Hiscocks <steven@hiscocks.me.uk> | 2013-02-17 11:48:13 +0000 |
|---|---|---|
| committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-07-05 14:19:15 -0400 |
| commit | 2f5a35a755f5ca046ecb04b2d01dfbe19a21447d (patch) | |
| tree | 12d86ea0ff621e88ca85b71b25d181b5133f40cb /systemd | |
| parent | 9d405a0928e3a293da662111409cfb6d00d03b72 (diff) | |
| download | python-systemd-2f5a35a755f5ca046ecb04b2d01dfbe19a21447d.tar.gz | |
systemd-python: Journal this_boot/machine now accepts ID
Diffstat (limited to 'systemd')
| -rw-r--r-- | systemd/journal.py | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/systemd/journal.py b/systemd/journal.py index ab8661e..60c8111 100644 --- a/systemd/journal.py +++ b/systemd/journal.py @@ -142,13 +142,28 @@ class Journal(_Journal): else: raise ValueError("Log level must be 0 <= level <= 7") - def this_boot(self): - """Add match for _BOOT_ID equal to current boot ID.""" - self.add_match(_BOOT_ID=_id128.get_boot().hex) + def this_boot(self, bootid=None): + """Add match for _BOOT_ID equal to current boot ID or the specified boot ID. + + bootid should be either a UUID or a 32 digit hex number. + """ + if bootid is None: + bootid = _id128.get_boot().hex + else: + bootid = getattr(bootid, 'hex', bootid) + self.add_match(_BOOT_ID=bootid) + + def this_machine(self, machineid=None): + """Add match for _MACHINE_ID equal to the ID of this machine. + + bootid should be either a UUID or a 32 digit hex number. + """ + if machineid is None: + machineid = _id128.get_machine().hex + else: + machineid = getattr(machineid, 'hex', machineid) + self.add_match(_MACHINE_ID=machineid) - def this_machine(self): - """Add match for _MACHINE_ID equal to the ID of this machine.""" - self.add_match(_MACHINE_ID=_id128.get_machine().hex) def _make_line(field, value): if isinstance(value, bytes): |
