| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
The example relies on implementation details, but I don't see
why it wouldn't work everywhere. Let's pull it in, and if it breaks
somewhere, we can remove it.
|
|\
| |
| | |
Fix notify fs leak
|
| | |
|
| | |
|
|/ |
|
|
|
|
|
|
|
| |
In systemd-233 the format of the constants file changed to use
SD_ID128_MAKE_STR macro and long lines are broken with '\'.
Doing this in sed is too anyoing — add a simple python script to
do the processing.
|
|
|
|
|
|
| |
We get <systemd.journal.JournalHandler object at ...> in older versions,
and <JournalHandler (NOTSET)> in since Python 3.6.
https://github.com/python/cpython/commit/c0752011472790e34d171b89f4b862cc3fd8ad08
|
|
|
|
|
|
| |
send() already does conversions in a type-specific way, and doing it
in journal handler would defeat those conversions. In particular, UUIDs
would be converted to early and have dashes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MESSAGE_ID passing was broken before previous commit:
TypeError: send() got multiple values for keyword argument 'MESSAGE_ID'
With the previous commit it's broken differently:
______________________________ test_journalhandler_message_id_on_handler _______________________________
def test_journalhandler_message_id_on_handler():
record = logging.LogRecord('test-logger', logging.INFO, 'testpath', 1, 'test', None, None)
sender = MockSender()
handler = journal.JournalHandler(logging.INFO, sender_function=sender.send,
MESSAGE_ID=TEST_MID)
handler.emit(record)
assert len(sender.buf) == 1
> assert 'MESSAGE_ID=' + TEST_MID.hex in sender.buf[0]
E assert ('MESSAGE_ID=' + '8441372f8dca4ca98694a6091fd8519f') in ['MESSAGE=test', 'MESSAGE_ID=8441372f-8dca-4ca9-8694-a6091fd8519f', 'CODE_FILE=testpath', 'CODE_LINE=1', 'name=test-logger', 'exc_info=None', ...]
E + where '8441372f8dca4ca98694a6091fd8519f' = UUID('8441372f-8dca-4ca9-8694-a6091fd8519f').hex
systemd/test/test_journal.py:116: AssertionError
______________________________ test_journalhandler_message_id_on_message _______________________________
def test_journalhandler_message_id_on_message():
record = logging.LogRecord('test-logger', logging.INFO, 'testpath', 1, 'test', None, None)
record.__dict__['MESSAGE_ID'] = TEST_MID2
sender = MockSender()
handler = journal.JournalHandler(logging.INFO, sender_function=sender.send,
MESSAGE_ID=TEST_MID)
handler.emit(record)
assert len(sender.buf) == 1
> assert 'MESSAGE_ID=' + TEST_MID2.hex in sender.buf[0]
E assert ('MESSAGE_ID=' + '8441370000000000000000001fd85000') in ['MESSAGE=test', 'MESSAGE_ID=84413700-0000-0000-0000-00001fd85000', 'CODE_FILE=testpath', 'CODE_LINE=1', 'name=test-logger', 'exc_info=None', ...]
E + where '8441370000000000000000001fd85000' = UUID('84413700-0000-0000-0000-00001fd85000').hex
systemd/test/test_journal.py:135: AssertionError
============================ 2 failed, 53 passed, 6 skipped in 0.16 seconds ============================
|
|
|
|
|
|
| |
Removed mid variable from JournalHandler since the MESSAGE_ID is already
in the extras variable. MESSAGE_ID was being set to None, but this won't
appear in the logs.
|
|
|
|
|
|
|
| |
Let's not try to make it look like a journal field. It should
be a normal parameter.
Followup for dce0a855c3281e7051b1cbe0f73386d1c90ef320.
|
|
|
|
|
| |
As with other functions, the wrapper is always present, but returns
OSError: [Errno 38] Function not implemented.
|
|
|
|
| |
Backwards compatibility for mapPriority is retained.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
This way we can skip ENOENT (which happens in containers).
While at it, let's extend the tests a bit, so that we at least
call all functions and check the type of the return value.
Also, drop '.nspawn' from the machine name, nspawn doesn't
use that suffix any more.
|
|
|
|
| |
Make _make_line concatenate only strings directly.
|
|\
| |
| | |
daemon: add basic support for sd_is_socket_sockaddr
|
| | |
|
| |
| |
| |
| | |
Specifying the address without does not work.
|
| |
| |
| |
| | |
Not particularly useful, but let's have it for completeness.
|
| |
| |
| |
| | |
Oh, Ubuntu!
|
| |
| |
| |
| | |
Later on a proper wrapper in daemon.py should be added.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In _reader we were raising OSError(errno=ENOSYS), but in _dameon
we were raising NotImplementedError. Let's always use ENOSYS.
Also, make the messages in _reader more specific.
Fixes #33.
|
| |
| |
| |
| |
| |
| |
| |
| | |
When running in a chroot, doctests that called journal.stream would
fail with ENOENT. Move the tests to test_journal, where we can skip
tests properly (without uglyfying the documentation).
Fixes #32.
|
| |
| |
| | |
py3 doesn't have dict.iteritems() anymore.
|
| |
| |
| |
| |
| | |
This bind() call may fail if TMPDIR is too long.
Bug: https://bugs.gentoo.org/610368
|
|/
|
| |
https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior
|
|
|
|
| |
This approach allows to use LoggerAdapter+extra or .info(.., extra={})
to transparently add extra fields to journal.
|
| |
|
|
|
|
|
|
|
|
|
| |
It's fairly easy to provide a reasonable default for the first argument.
Let's do that.
Also, the documentation was misleading, suggesting that the function itself
can be passed as file parameter to print(). Use a different name for the
temporary variable to clarify that.
|
|
|
|
|
| |
By default debug messages are ignored, and INFO should be used for
"normal" messages.
|
| |
|
| |
|
|
|
|
| |
build/lib.linux-x86_64-3.5/systemd/journal.py:docstring of systemd.journal.stream:15: WARNING: Literal block expected; none found.
|
|
|
|
| |
Should fix #12.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of generating the list of message ids anew during every build,
the file is generated manually and committed into the
repository. Also, the list of defines is stored in id128-defines.h,
also kept in the repository. Both files should only grow.
This should make build easier. But it also fixes a problem with
systemd, which occasionally drops message definitions. We will keep
them forever, so it should be safe to rely on the presence of message
definitions which systemd does not use anymore.
Fixes #23.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This somewhat breaks backwards compatibility, but not for the
previously documented arguments: floats are now interpreted
differently, but ints and datetime.datetime objects are interpreted
the same as before. But the documentation clearly stated that only
ints and datetime.datetime objects were allowed.
This makes seek_realtime match seek_monotonic and other functions
which take time and follows the principle of least surprise.
Fixes #21.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Let's pass any flags through to the journal functions without checking
validity. Those functions do their own checking, so there's no need to
second-guess.
The semantics for _Reader(flags=0) are a bit changed:
before, this would be transformed into sd_journal_open(SD_J_LOCAL_ONLY).
Now, this results in sd_journal_open(0). Previous behaviour should be
achieved by not specifying the flags at all.
This change is necessary, because previously it was not possible to
pass flags=0 to sd_journal_open(0), i.e. it was not possible to "merge"
journals through the Python interface.
Similarly, Reader(flags=0) now means to open all journals, and
Reader(flags=None) is the same as Reader(flags=LOCAL_ONLY).
|
| |
|
|
|
|
|
| |
Those are field names and they should always be ASCII, and converting
them to str automatically makes the answer more useful.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Wrapping the sources to ~80 columns means that the formatted output is
annoying to read. Rewrap to ~74 columns in the output.
Also remove some obsolete descritions of journal permissions and refer
to journalctl(1) instead.
Add some missing docstrings.
|
| |
|
| |
|