Python systemd wrapper
Project description
Python systemd wrapper using Cython
Systemd daemon notification
from systemd.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 systemd 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 systemd 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
systemd-0.8.8.tar.gz
(76.8 kB
view details)
File details
Details for the file systemd-0.8.8.tar.gz
.
File metadata
- Download URL: systemd-0.8.8.tar.gz
- Upload date:
- Size: 76.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41f44aac62c4a4519f7174559a9fa62b1165d7523292ebe0f59da8381eafe16b |
|
MD5 | ce9da810fd0484dd28a02944e626d8c6 |
|
BLAKE2b-256 | 8aa445f60d0e392bdfc7d4c4c6544b4ec0f29f567803dfe63eecca32a1690ea0 |