Age | Commit message (Collapse) | Author |
|
This can give huge efficiency gains, e.g. if only MESSAGE
is required and all other fields can be ignored.
|
|
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.
|
|
This one wraps sd_journal_get_catalog_from_message_id.
Thanks to Python namespacing, we can stick to a shorter name.
|
|
|
|
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.
|
|
This way python code follows the original interface more closely.
Also, .seek(0, journal.SEEK_END) was just to much to type.
|
|
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.
|
|
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.
|
|
In Python 3, a named tuple is used. In Python 2, a simple
tuple is used. In either case, the pair is (timestamp, bootid).
|
|
__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.
|
|
|
|
|
|
|
|
Rather than catch all, is now limited to UnicodeDecodeError
|
|
|
|
|
|
|
|
|
|
|
|
python code now takes care of multiple matches
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Build instructions:
make
make DESTIDIR=/tmp/... install
make DESTIDIR=/tmp/... sphinx-html sphinx-man sphinx-epub ...
|
|
|
|
uuid.UUIDs are utilized to hold UUID values.
|
|
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 ]
|
|
|
|
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.
|
|
|