SystemD wrapper on Cython
Project description
Python systemd wrapper using Cython
Installation
Binary packages
Centos 7 Ubuntu (xenial/bionic) and Debian 8 packages available on github releases.
Installation from sources
You should install systemd headers
For debian users:
apt-get install build-essential \
libsystemd-journal-dev \
libsystemd-daemon-dev \
libsystemd-dev
For CentOS/RHEL
yum install gcc systemd-devel
And install it from pypi
pip install cysystemd
Usage examples
Systemd daemon notification
from cysystemd.daemon import notify, Notification
# Send READY=1
notify(Notification.READY)
# Send status
notify(Notification.STATUS, "I'm fine.")
# Send stopping
notify(Notification.STOPPING)
Write message into Systemd journal
from cysystemd import journal
journal.write("Hello Lennart")
# Or send structured data
journal.send(
message="Hello Lennart",
priority=journal.Priority.INFO,
some_field='some value',
)
Or add logging handler to python logger
from cysystemd import journal
import logging
import uuid
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()
logger.addHandler(journal.JournaldLogHandler())
try:
log.info("Trying to do something")
raise Exception('foo')
except:
logger.exception("Test Exception %s", 1)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cysystemd-0.17.1.tar.gz
(169.9 kB
view details)
File details
Details for the file cysystemd-0.17.1.tar.gz
.
File metadata
- Download URL: cysystemd-0.17.1.tar.gz
- Upload date:
- Size: 169.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/33.1.1 requests-toolbelt/0.8.0 tqdm/4.20.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04941a73cb0fe214b4c9ab032e81da1a0d28a4f932404ec89514865bd52f9a77 |
|
MD5 | 5ef062b922275ea2994cdf63aab85266 |
|
BLAKE2b-256 | 5439994eec23f5f421577f9e7bea674c2dc377bc4805c65bfb20fecc5c580538 |