chiark / gitweb /
systemd-python: export sd_j_get_fd, sd_j_reliable_fd, sd_j_close
[elogind.git] / src / python-systemd / docs / journal.rst
index 9d627ce3ed8f5c13175b6ca0c21b089159fda8e4..9dc495ffdb685ff5b331f822598b82e2a6183366 100644 (file)
 Accessing the Journal
 ---------------------
 
-.. autoclass:: _Journal
+.. autoclass:: _Reader
    :undoc-members:
    :inherited-members:
 
-.. autoclass:: Journal
+.. autoclass:: Reader
    :undoc-members:
    :inherited-members:
 
    .. automethod:: __init__
 
+.. autoclass:: Monotonic
+
 .. autoattribute:: systemd.journal.DEFAULT_CONVERTERS
 
-Whence constants
-~~~~~~~~~~~~~~~~
+Example: polling for journal events
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This example shows that journal events can be waited for (using
+e.g. `poll`). This makes it easy to integrate Reader in an external
+event loop:
+
+  >>> import select
+  >>> from systemd import journal
+  >>> j = journal.Reader()
+  >>> j.seek_tail()
+  >>> p = select.poll()
+  >>> p.register(j, select.POLLIN)
+  >>> p.poll()
+  [(3, 1)]
+  >>> j.get_next()
 
-.. autoattribute:: systemd.journal.SEEK_SET
-.. autoattribute:: systemd.journal.SEEK_CUR
-.. autoattribute:: systemd.journal.SEEK_END
 
 Journal access types
 ~~~~~~~~~~~~~~~~~~~~