Re: [systemd-devel] Native journald logging for Python

2012-06-26 Thread David Strauss
Oh, and I'll look at PyString_AsStringAndSize in a bit. A Python 3 patch would be most welcome as a pull request on GitHub. -- David Strauss    | [email protected] ___ systemd-devel mailing list [email protected] http://lists.free

Re: [systemd-devel] Native journald logging for Python

2012-06-26 Thread David Strauss
Fixed on GitHub: diff --git a/journald.c b/journald.c index 0efc223..b106c52 100644 --- a/journald.c +++ b/journald.c @@ -17,6 +17,12 @@ journald_send(PyObject *self, PyObject *args) { for (i = 0; i < argc; ++i) { PyObject *item = PyTuple_GetItem(args, i); char * stritem = P

Re: [systemd-devel] Native journald logging for Python

2012-06-26 Thread David Strauss
I'll figure it out. :-) On Jun 26, 2012 10:32 AM, "Zbigniew Jędrzejewski-Szmek" wrote: > On 06/26/2012 05:31 PM, Zbigniew Jędrzejewski-Szmek wrote: > > PyObject *item = PyTuple_GetItem(args, i); > > char * stritem = PyString_AsString(item); > > iov[i].iov_base = stritem; > > iov[i].iov_len = strl

Re: [systemd-devel] Native journald logging for Python

2012-06-26 Thread Zbigniew Jędrzejewski-Szmek
On 06/26/2012 05:31 PM, Zbigniew Jędrzejewski-Szmek wrote: > PyObject *item = PyTuple_GetItem(args, i); > char * stritem = PyString_AsString(item); > iov[i].iov_base = stritem; > iov[i].iov_len = strlen(stritem); > > I think that there's a problem here -- PyString_AsString will return > NULL if it

Re: [systemd-devel] Native journald logging for Python

2012-06-26 Thread Zbigniew Jędrzejewski-Szmek
On 06/26/2012 10:31 AM, David Strauss wrote: > I spent a bit of time on IRC earlier today trying to figure out how to > log to journald fields using Python. Apparently, that requires use of > the native journald C API. > > So, I wrote the necessary glue: > https://github.com/davidstrauss/journald-

[systemd-devel] Native journald logging for Python

2012-06-26 Thread David Strauss
I spent a bit of time on IRC earlier today trying to figure out how to log to journald fields using Python. Apparently, that requires use of the native journald C API. So, I wrote the necessary glue: https://github.com/davidstrauss/journald-python You can install it using PIP or any preferred set