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


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for python-logging-json-formatter, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size python_logging_json_formatter-0.1.0-py2.py3-none-any.whl (4.6 kB) File type Wheel Python version 2.7 Upload date Hashes View hashes
Filename, size python-logging-json-formatter-0.1.0.tar.gz (4.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page