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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

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