Skip to main content

Simplifies logging for systemd

Project description

https://github.com/idlesign/systemd-logging

release lic ci coverage

Description

Simplifies logging for systemd

Requires Python 3.6+

  • No need to compile (pure Python), uses libsystemd.so.

  • Simplified configuration.

  • Just logging. Nothing more.

Usage

import logging

from systemdlogging.toolbox import init_systemd_logging

# This one line in most cases would be enough.
# By default it attaches systemd logging handler to a root Python logger.
init_systemd_logging()  # Returns True if initialization went fine.

# Now you can use logging as usual.
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

logger.debug('My debug message')

try:
    raise ValueError('Log me please')

except ValueError:
    # Additional context can be passed in extra.context.
    logger.exception('Something terrible just happened', extra={
        'message_id': True,  # Generate message ID automatically.
        'context': {
            'FIELD1': 'one',
            'FIELD2': 'two',
        }
    }, stack_info=True)

Read the docs to find out more.

Documentation

https://systemd-logging.readthedocs.org/

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

systemd-logging-0.3.1.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

systemd_logging-0.3.1-py2.py3-none-any.whl (6.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file systemd-logging-0.3.1.tar.gz.

File metadata

  • Download URL: systemd-logging-0.3.1.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for systemd-logging-0.3.1.tar.gz
Algorithm Hash digest
SHA256 b0a64482e55053af7751f07ca61ecacf7d95b36eb10385fcac46a40686b9341e
MD5 e73ec36fa62c3c9132618093777ef44e
BLAKE2b-256 2faf9808fa13f747824ac56b7c8924902121f5dd288a915966cf59f36b9aa4ed

See more details on using hashes here.

File details

Details for the file systemd_logging-0.3.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for systemd_logging-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7d98e53c95bc3506109c8667107326a58e2bf81d88d28c0f4db9f9ab254acca1
MD5 59e39206613edf48219113004ce99ce2
BLAKE2b-256 bbab6558daefc09d445d3f856122df409e50289dc89e320a502d3645f08e75fd

See more details on using hashes here.

Supported by

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