summaryrefslogtreecommitdiff
path: root/src/python-systemd/journal.py
AgeCommit message (Collapse)Author
2014-04-05systemd-python: use .hex instead of .get_hex()Zbigniew Jędrzejewski-Szmek
It turns out the latter got removed in Python 3. https://bugs.freedesktop.org/show_bug.cgi?id=77086
2013-11-07systemd-python: convert keyword value to stringRichard Marko
Allows using journal.send('msg', PRIORITY=journal.LOG_CRIT) Before this commit this results in TypeError: cannot concatenate 'str' and 'int' objects and requires passing PRIORITY value as string to work.
2013-07-17systemd-python: add support for sd_j_open_filesZbigniew Jędrzejewski-Szmek
Also export missing flags.
2013-07-17systemd-python: fix iterationZbigniew Jędrzejewski-Szmek
Back in 6a58bf4135 raising stop iteration was removed from the C code, but wasn't added in the Python counterpart.
2013-05-16systemd-python: do not attempt to convert str to bytesZbigniew Jędrzejewski-Szmek
Bug-spotted-by: Steven Hiscocks <steven-systemd@hiscocks.me.uk>
2013-05-08systemd-python: add __version__ stringsZbigniew Jędrzejewski-Szmek
2013-05-03Spelling fixesVille Skyttä
2013-04-25systemd-python: attach fields to JournalHandler, add SYSLOG_IDENTIFIERZbigniew Jędrzejewski-Szmek
Arbitrary fields can be attached at the level of the handler, and they'll be sent with all messages from this handler. This facility is used to attach SYSLOG_IDENTIFIER to all messages, since otherwise journald attaches SYSLOG_IDENTIFIER=python or something similar, which is completely useless.
2013-04-17python-systemd: Reader return special fields and _Reader changesSteven Hiscocks
Changes to _Reader make it match closer to C API, by removing `get_next` and `get_previous`. A `get_all` method added, which returns dictionary of fields using C API SD_JOURNAL_FOREACH_DATA macro, which can be used in conjunction with `next`. _Reader `get`, `next`, `get_{realtime,monotonic,cursor}` and new `previous` methods are made private. This is so the traversal and getting of journal fields can be made transparent in the python interface. Reader now solely implements `get_next` and `get_previous`, returning a standard dictionary (future: other mapping types?) with all standard and special fields through the converters. This makes the output the same as journalctl json/export format output. Iterator methods also moved to Reader, as they do not function as intend with changes to _Reader. These changes also mean that more optimised journal interfaces can be made more easily from _Reader, by avoiding getting of unrequired fields by using the `_get` method, and avoiding field conversions.
2013-04-06systemd-python: fix wait bugSteven Hiscocks
2013-03-21systemd-python: allow retrieval of single fieldsZbigniew Jędrzejewski-Szmek
This can give huge efficiency gains, e.g. if only MESSAGE is required and all other fields can be ignored.
2013-03-21systemd-python: cleanup up usec_t handlingZbigniew Jędrzejewski-Szmek
The behaviour wrt. seconds vs. microseconds was inconsistent. Now _Reader always uses native units (us), while Reader always uses seconds and accepts both floats and ints. This way the conversion is always done in the Python layer, and the lower level API allows access to the journal API without the potentially lossy conversion between double and uint64_t.
2013-03-19systemd-python: add journal.get_catalog()Zbigniew Jędrzejewski-Szmek
This one wraps sd_journal_get_catalog_from_message_id. Thanks to Python namespacing, we can stick to a shorter name.
2013-03-07systemd-python: update documentation for new systemd-journal groupZbigniew Jędrzejewski-Szmek
2013-03-07systemd-python: refuse path and flags together in __init__Zbigniew Jędrzejewski-Szmek
It's better to explictly check, instead of just documenting it. The return value from init is changed from 1 to -1 on error. Python seems to ignore 1 every second time. Looks like a bug in Python, but the return value doesn't seem to be documented anywhere, and -1 works as expected... so let's just use that.
2013-03-07systemd-python: split .seek() into .seek_head() and .seek_tail()Zbigniew Jędrzejewski-Szmek
This way python code follows the original interface more closely. Also, .seek(0, journal.SEEK_END) was just to much to type.
2013-03-07systemd-python: catch only ValueErrors in conversion codeZbigniew Jędrzejewski-Szmek
First of all, 'try: ... except: ...' (with no exception specified) is always a no-no, since it catches all BaseExceptions, which includes ^C and other stuff which should almost never be caught. Now the conversion is stricter, and only one conversion is attempted, and only a ValueEror is caught. It seems reasonable to catch ValueErrors, since the entries in the journal are not verified, and any erroneous application might log a field which cannot be converted. The consumer of events must only check if a field is an instance of bytes and can otherwise assume that the conversion was performed correctly. Order of arguments in Reader.__init__ has been changed to match order in _Reader.__init__. Conversions have been updated to work under Python 2 and 3.
2013-02-28python-systemd: rename Journal to ReaderZbigniew Jędrzejewski-Szmek
It seems inevitable that we'll also grow a writing interface, and then it'll be cumbersome to have a "Journal" for reading, and a "Writer" for writing.
2013-02-28systemd-python: return both parts of sd_journal_get_monotonic_usecZbigniew Jędrzejewski-Szmek
In Python 3, a named tuple is used. In Python 2, a simple tuple is used. In either case, the pair is (timestamp, bootid).
2013-02-28python-systemd: check all errors and use automatic cleanupZbigniew Jędrzejewski-Szmek
__REALTIME_TIMESTAMP and __MONOTONIC_TIMESTAMP return ints. It doesn't make sense to convert to string, just to convert back to a number later on. Also try to follow systemd rules for indentation.
2013-02-28systemd-python: hide ChainMap importZbigniew Jędrzejewski-Szmek
2013-02-28systemd-python: polish the docstringsZbigniew Jędrzejewski-Szmek
2013-02-22systemd-python: Added doc string for JournalSteven Hiscocks
2013-02-22systemd-python: Journal convert_unicode exception handling changeSteven Hiscocks
Rather than catch all, is now limited to UnicodeDecodeError
2013-02-22systemd-python: add Journal method to add MESSAGE_ID matchSteven Hiscocks
2013-02-22systemd-python: update Journal python docstringsSteven Hiscocks
2013-02-22systemd-python: tidy up import names in journalSteven Hiscocks
2013-02-22systemd-python: Journal this_boot/machine now accepts IDSteven Hiscocks
2013-02-22systemd-python: _reader now takes unix timestamp in secondsSteven Hiscocks
2013-02-22systemd-python: _reader add_match takes single stringSteven Hiscocks
python code now takes care of multiple matches
2013-02-22systemd-python: Moved _reader datetime usage to pythonSteven Hiscocks
2013-02-22systemd-python: Tidy up _reader error handlingSteven Hiscocks
2013-02-22systemd-python: some python3 and bug fixesSteven Hiscocks
2013-02-22systemd-python: implement this_boot/this_machine in PythonSteven Hiscocks
2013-02-22systemd-python: Journal log_level moved to pythonSteven Hiscocks
2013-02-22systemd-python: move default call dicts from C to pythonSteven Hiscocks
2013-02-22systemd-python: MESSAGE_ID as UUID for JournalSteven Hiscocks
2013-02-22systemd-python: moved PyRun_String to journal.py codeSteven Hiscocks
2013-02-22systemd-python: add Journal class for reading journalSteven Hiscocks
2013-02-22python: build html docs using sphinxZbigniew Jędrzejewski-Szmek
Build instructions: make make DESTIDIR=/tmp/... install make DESTIDIR=/tmp/... sphinx-html sphinx-man sphinx-epub ...
2013-02-22python: utilize uuid.UUID in loggingZbigniew Jędrzejewski-Szmek
2013-02-22python: add systemd.id128 moduleZbigniew Jędrzejewski-Szmek
uuid.UUIDs are utilized to hold UUID values.
2012-11-13python: add journal backend for the logging frameworkMarti Raudsepp
Supports Python versions 2.6 through 3.3 (tested on 2.7 and 3.2). See JournalHandler docstring for usage details. [zj: - use send() instead of using sendv() directly - do exception handling like in the logging module - bumped min version to python2.6, since the module does not work with python2.5 anyway ]
2012-09-13python: reindent to follow coding styleLennart Poettering
2012-09-13python: change license to LGPL 2.1Lennart Poettering
The original license has been MIT for this code, but David Strauss (its original author) agreed to relicense it to LGPL 2.1 for inclusion in systemd.
2012-09-13python: integrate David Strauss' python-systemd packageLennart Poettering