Skip to main content

Pure python logging handler for writing logs to the journald using native protocol

Project description

Pure python logging handler for writing logs to the journald using native protocol.

import logging
from logging_journald import JournaldLogHandler

# Use python default handler
LOG_HANDLERS = None


if (
    # Check if program running as systemd service
    JournaldLogHandler.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.0.tar.gz (4.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page