Pure python logging handler for writing logs to the journald using native protocol
Project description
logging-journald
Pure python logging handler for writing logs to the journald using native protocol.
import logging
from logging_journald import JournaldLogHandler, check_journal_stream
# Use python default handler
LOG_HANDLERS = None
if (
# Check if program running as systemd service
check_journal_stream() or
# Check if journald socket is available
JournaldLogHandler.SOCKET_PATH.exists()
):
LOG_HANDLERS = [JournaldLogHandler()]
logging.basicConfig(level=logging.INFO, handlers=LOG_HANDLERS)
logging.info("Hello logging world.")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
logging_journald-0.6.6.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for logging_journald-0.6.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afcedadcd82c668794a68aa1243fbe0f6e0ecfec1f24c79b3baa064a5d18af14 |
|
MD5 | e5709f8b3a53e24bfcc1f7c43cc140a0 |
|
BLAKE2b-256 | 60d3ff2810077efec2cded75df757dec00b6a5d7a6bc5e418f35e0c0535390bb |