mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
sd_journal_get_fd(j) is called j.fileno(), for compatiblity with Python conventions for file-like objects. More importantly, those new .seek_head() and .seek_tail() do not call .get_next(). This is better, if one wants to skip before retrieving an entry.
61 lines
1.3 KiB
ReStructuredText
61 lines
1.3 KiB
ReStructuredText
`systemd.journal` module
|
|
========================
|
|
|
|
.. automodule:: systemd.journal
|
|
:members: send, sendv, stream, stream_fd
|
|
:undoc-members:
|
|
|
|
`JournalHandler` class
|
|
----------------------
|
|
|
|
.. autoclass:: JournalHandler
|
|
|
|
Accessing the Journal
|
|
---------------------
|
|
|
|
.. autoclass:: _Reader
|
|
:undoc-members:
|
|
:inherited-members:
|
|
|
|
.. autoclass:: Reader
|
|
:undoc-members:
|
|
:inherited-members:
|
|
|
|
.. automethod:: __init__
|
|
|
|
.. autoclass:: Monotonic
|
|
|
|
.. autoattribute:: systemd.journal.DEFAULT_CONVERTERS
|
|
|
|
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()
|
|
|
|
|
|
Journal access types
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
.. autoattribute:: systemd.journal.LOCAL_ONLY
|
|
.. autoattribute:: systemd.journal.RUNTIME_ONLY
|
|
.. autoattribute:: systemd.journal.SYSTEM_ONLY
|
|
|
|
Journal event types
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
.. autoattribute:: systemd.journal.NOP
|
|
.. autoattribute:: systemd.journal.APPEND
|
|
.. autoattribute:: systemd.journal.INVALIDATE
|