in pystemd/journal.pyx [0:0]
def sendv(*args, **kwargs):
"""
send lines directly to the journal.
example:
```python
import logging
import pystemd.journal
pystemd.journal.sendv(
f"PRIORITY={logging.INFO}",
MESSAGE="everything is awesome",
SYSLOG_IDENTIFIER="tegan"
)
```
"""
cdef:
char * text
int le
bytes i_str
dbusc.iovec * iov
all_options = [
x2char_star(i)
for i in args
] + [
b"=".join([x2char_star(key), x2char_star(val, convert_all=True)])
for key, val in kwargs.items()
]
le = len(all_options)
iov = <dbusc.iovec *> malloc(le * sizeof(dbusc.iovec))
for i, iv in enumerate(all_options):
i_str = iv
text = i_str
iov[i].iov_base = text
iov[i].iov_len = len(text)
dbusc.sd_journal_sendv(iov, len(all_options))
free(iov)