Commit Graph
31 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 5c1c14b3a0 systemd-python: split .seek() into .seek_head() and .seek_tail()
This way python code follows the original interface more closely.
Also, .seek(0, journal.SEEK_END) was just to much to type.
2013-03-07 00:45:56 -05:00
Zbigniew Jędrzejewski-Szmek aaf0806118 systemd-python: catch only ValueErrors in conversion code
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-03-07 00:45:56 -05:00
Zbigniew Jędrzejewski-Szmek 7f41820b07 python-systemd: rename Journal to Reader
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-28 20:04:17 -05:00
Zbigniew Jędrzejewski-Szmek 86e3d32a1d systemd-python: return both parts of sd_journal_get_monotonic_usec
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-28 20:04:17 -05:00
Zbigniew Jędrzejewski-Szmek 6a6633a16a python-systemd: check all errors and use automatic cleanup
__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-28 20:04:17 -05:00
Zbigniew Jędrzejewski-Szmek 5c083fa815 systemd-python: hide ChainMap import 2013-02-28 20:04:17 -05:00
Zbigniew Jędrzejewski-Szmek 2c07646764 systemd-python: polish the docstrings 2013-02-28 19:36:14 -05:00
Steven Hiscocks cac40fbe24 systemd-python: Added doc string for Journal 2013-02-22 16:57:45 +01:00
Steven Hiscocks eccc9e74d2 systemd-python: Journal convert_unicode exception handling change
Rather than catch all, is now limited to UnicodeDecodeError
2013-02-22 16:57:44 +01:00
Steven Hiscocks 89d9a23389 systemd-python: add Journal method to add MESSAGE_ID match 2013-02-22 16:57:44 +01:00
Steven Hiscocks c71f26eba5 systemd-python: update Journal python docstrings 2013-02-22 16:57:44 +01:00
Steven Hiscocks b835982344 systemd-python: tidy up import names in journal 2013-02-22 16:57:44 +01:00
Steven Hiscocks 301ae164b7 systemd-python: Journal this_boot/machine now accepts ID 2013-02-22 16:57:44 +01:00
Steven Hiscocks 518dc5dff5 systemd-python: _reader now takes unix timestamp in seconds 2013-02-22 16:57:44 +01:00
Steven Hiscocks 5bb2b8d5e4 systemd-python: _reader add_match takes single string
python code now takes care of multiple matches
2013-02-22 16:57:44 +01:00
Steven Hiscocks 7a1b9cd5e4 systemd-python: Moved _reader datetime usage to python 2013-02-22 16:57:44 +01:00
Steven Hiscocks 71766afa2d systemd-python: Tidy up _reader error handling 2013-02-22 16:57:44 +01:00
Steven Hiscocks bf1ced5503 systemd-python: some python3 and bug fixes 2013-02-22 16:57:44 +01:00
Steven Hiscocks 6a71de70e5 systemd-python: implement this_boot/this_machine in Python 2013-02-22 16:57:43 +01:00
Steven Hiscocks 25523db4e1 systemd-python: Journal log_level moved to python 2013-02-22 16:57:43 +01:00
Steven Hiscocks 3aa8f0861c systemd-python: move default call dicts from C to python 2013-02-22 16:57:43 +01:00
Steven Hiscocks 3ce2cc25bb systemd-python: MESSAGE_ID as UUID for Journal 2013-02-22 16:57:43 +01:00
Steven Hiscocks 2d0603bd97 systemd-python: moved PyRun_String to journal.py code 2013-02-22 16:57:43 +01:00
Steven Hiscocks c4e9b5b557 systemd-python: add Journal class for reading journal 2013-02-22 16:57:43 +01:00
Zbigniew Jędrzejewski-Szmek 9015fa646e python: build html docs using sphinx
Build instructions:
   make
   make DESTIDIR=/tmp/... install
   make DESTIDIR=/tmp/... sphinx-html sphinx-man sphinx-epub ...
2013-02-22 16:57:43 +01:00
Zbigniew Jędrzejewski-Szmek afcd68c149 python: utilize uuid.UUID in logging 2013-02-22 16:57:43 +01:00
Zbigniew Jędrzejewski-Szmek 927e96326c python: add systemd.id128 module
uuid.UUIDs are utilized to hold UUID values.
2013-02-22 16:57:43 +01:00
Marti Raudsepp 73c0495f68 python: add journal backend for the logging framework
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-11-13 11:13:52 +01:00
Lennart Poettering 0aee68ad02 python: reindent to follow coding style 2012-09-13 04:16:10 +02:00
Lennart Poettering 6b91ae13f2 python: change license to LGPL 2.1
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-13 04:06:11 +02:00
Lennart Poettering 8d7e170a52 python: integrate David Strauss' python-systemd package 2012-09-13 04:01:18 +02:00