Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

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

Project description

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

This version
History Node

0.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
python_logging_json_formatter-0.1.0-py2.py3-none-any.whl (4.6 kB) Copy SHA256 hash SHA256 Wheel 2.7 Sep 25, 2015
python-logging-json-formatter-0.1.0.tar.gz (4.4 kB) Copy SHA256 hash SHA256 Source None Sep 25, 2015

Supported by

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