Skip to main content

A logging formatter that appends extra data as JSON, e.g. for loggly

Project description

https://img.shields.io/travis/opbeat/python-logging-json-formatter.svg https://img.shields.io/pypi/v/python-logging-json-formatter.svg

A logging Formatter that appends extra data as JSON, e.g. for loggly

USAGE

Using dictConfig

import logging.config

logging.config.dictConfig({
    'version': 1,
    'formatters': {
        'append_json': {
            '()': 'logging_json_formatter.AppendJSONFormatter',
            'format': '%(asctime)s %(name)s %(levelname)s %(funcName)s  %(filename)s:%(lineno)s %(message)s',

            # only use a specific set of keys
            'limit_keys_to': ['org_uuid', 'app_uuid'],

            # force keys that are ignored by default
            'force_keys': ('levelname', 'lineno'),
        }
    },
    'handlers': {
        'syslog': {
            'level': 'ERROR',
            'class': 'logging.handlers.SysLogHandler'
            'address': '/dev/log',
            'formatter': 'append_json'
        },
    },
}

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

python-logging-json-formatter-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

python_logging_json_formatter-0.1.0-py2.py3-none-any.whl (4.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file python-logging-json-formatter-0.1.0.tar.gz.

File metadata

File hashes

Hashes for python-logging-json-formatter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 39078cb87291bfdcda6e763eb33c87250080414fcc23f86f68a97b50d9391e61
MD5 3bf2e66875bb5ee08e5ad9b8c8753607
BLAKE2b-256 e82f116a7d04351cf1e2a428eabd4b0ea0ee8520b45cece163fded796900ac20

See more details on using hashes here.

File details

Details for the file python_logging_json_formatter-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for python_logging_json_formatter-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 92a1de38130580516e5cde9fdb4fb32dbca3b36905e811c22562662b309f8c8e
MD5 a694dce09334a148b2b182601ba9fe05
BLAKE2b-256 c6e82d1a7a117eef998cb299749d590ed2b7339ed9c0fa8c6c88df4394bf8c1a

See more details on using hashes here.

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