summaryrefslogtreecommitdiff
path: root/systemd
diff options
context:
space:
mode:
authorSteven Hiscocks <steven@hiscocks.me.uk>2013-02-19 20:39:45 +0000
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-07-05 14:19:16 -0400
commit31d2aff90e92cf79d2bb154b4c8db5255410f39c (patch)
tree9b1001c1f2b9d789843db18ff61d460d41fe39fc /systemd
parent7df62d3a00d5345369ea5ccb2d410fa970f4bebe (diff)
downloadpython-systemd-31d2aff90e92cf79d2bb154b4c8db5255410f39c.tar.gz
systemd-python: Added doc string for Journal
Diffstat (limited to 'systemd')
-rw-r--r--systemd/journal.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/systemd/journal.py b/systemd/journal.py
index 5c5f5ca..d63722b 100644
--- a/systemd/journal.py
+++ b/systemd/journal.py
@@ -79,6 +79,24 @@ else:
_convert_unicode = _functools.partial(unicode, encoding='utf-8')
class Journal(_Journal):
+ """Journal allows the access and filtering of systemd journal
+ entries. Note that in order to access the system journal, a
+ non-root user must be in the `adm` group.
+
+ Example usage to print out all error or higher level messages
+ for systemd-udevd for the boot:
+
+ >>> myjournal = journal.Journal()
+ >>> myjournal.add_boot_match(journal.CURRENT_BOOT)
+ >>> myjournal.add_loglevel_matches(journal.LOG_ERR)
+ >>> myjournal.add_match(_SYSTEMD_UNIT="systemd-udevd.service")
+ >>> from __future__ import print_function
+ >>> for entry in myjournal:
+ ... print(entry['MESSAGE'])
+
+ See man page "systemd.journal-fields" for more info on
+ typical fields found in the journal.
+ """
def __init__(self, converters=None, flags=LOCAL_ONLY, path=None):
"""Creates instance of Journal, which allows filtering and
return of journal entries.