Systemd utility functions in pure python
Project description
trick17
trick17
is a pure python, lightweight package that interfaces with various systemd components.
Table of Contents
Installation
pip install trick17
Modules
trick17.daemon
daemon.booted()
returnsTrue
if system was booted by systemd.daemon.notify(state)
sends a notification to systemd.listen_fds()
returns an list of (fd, name) tuples in case of socket activation, see systemd.socket
trick17.journal
The trick17.journal
allows to use the systemd Native Journal Protocol via the Python Logging facility.
JournalHandler
is alogging.Handler
subclass that speaks the systemd Native Journal Protocol- Function
stderr_is_journal()
can be used to check if logging viasys.stderr
should be upgraded to native logging, see Automatic Protocol Upgrading
import logging
from trick17 import journal
if journal.stderr_is_journal():
handler = journal.JournalHandler()
else:
handler = logging.StreamHandler()
root = logging.getLogger()
root.addHandler(handler)
logging.error('Something happened')
License
trick17
is distributed under the terms of the MIT license.
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
trick17-0.0.4rc0.tar.gz
(8.8 kB
view hashes)
Built Distribution
Close
Hashes for trick17-0.0.4rc0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba8afeee4146dbb3f99e9f7c139abfa9083997a2ad800aaa1ec43f454bacfb6f |
|
MD5 | 87442f45c0df6075cd7dd0b8b144c029 |
|
BLAKE2b-256 | 38fcc98ae62d9a4676a5a38ff470019a7265b91b39cee1326a8c840223aa96fc |