from syslog import (LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR,
LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG)
from ._journal import sendv, stream_fd
from syslog import (LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR,
LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG)
from ._journal import sendv, stream_fd
-from ._reader import (_Journal, NOP, APPEND, INVALIDATE,
+from ._reader import (_Reader, NOP, APPEND, INVALIDATE,
LOCAL_ONLY, RUNTIME_ONLY, SYSTEM_ONLY)
from . import id128 as _id128
LOCAL_ONLY, RUNTIME_ONLY, SYSTEM_ONLY)
from . import id128 as _id128
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:
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.add_boot_match(journal.CURRENT_BOOT)
>>> myjournal.add_loglevel_matches(journal.LOG_ERR)
>>> myjournal.add_match(_SYSTEMD_UNIT="systemd-udevd.service")
>>> myjournal.add_boot_match(journal.CURRENT_BOOT)
>>> myjournal.add_loglevel_matches(journal.LOG_ERR)
>>> myjournal.add_match(_SYSTEMD_UNIT="systemd-udevd.service")
found in the journal.
"""
def __init__(self, converters=None, flags=LOCAL_ONLY, path=None):
found in the journal.
"""
def __init__(self, converters=None, flags=LOCAL_ONLY, path=None):
return of journal entries.
Argument `converters` is a dictionary which updates the
DEFAULT_CONVERTERS to convert journal field values.
return of journal entries.
Argument `converters` is a dictionary which updates the
DEFAULT_CONVERTERS to convert journal field values.
if _sys.version_info >= (3,3):
self.converters = _ChainMap()
if converters is not None:
if _sys.version_info >= (3,3):
self.converters = _ChainMap()
if converters is not None:
def get_next(self, skip=1):
"""Return the next log entry as a dictionary of fields.
def get_next(self, skip=1):
"""Return the next log entry as a dictionary of fields.
Optional skip value will return the `skip`\-th log entry.
Entries will be processed with converters specified during
Optional skip value will return the `skip`\-th log entry.
Entries will be processed with converters specified during
Note this does not respect any journal matches.
Entries will be processed with converters specified during
Note this does not respect any journal matches.
Entries will be processed with converters specified during
def seek_realtime(self, realtime):
"""Seek to a matching journal entry nearest to `realtime` time.
def seek_realtime(self, realtime):
"""Seek to a matching journal entry nearest to `realtime` time.
"""
if isinstance(realtime, _datetime.datetime):
realtime = float(realtime.strftime("%s.%f"))
"""
if isinstance(realtime, _datetime.datetime):
realtime = float(realtime.strftime("%s.%f"))
def seek_monotonic(self, monotonic, bootid=None):
"""Seek to a matching journal entry nearest to `monotonic` time.
def seek_monotonic(self, monotonic, bootid=None):
"""Seek to a matching journal entry nearest to `monotonic` time.
monotonic = monotonic.totalseconds()
if isinstance(bootid, _uuid.UUID):
bootid = bootid.get_hex()
monotonic = monotonic.totalseconds()
if isinstance(bootid, _uuid.UUID):
bootid = bootid.get_hex()
def log_level(self, level):
"""Set maximum log `level` by setting matches for PRIORITY.
def log_level(self, level):
"""Set maximum log `level` by setting matches for PRIORITY.