Skip to main content

JSON log formatter

Project description

Usage example:

import logging

import json_log_formatter

formatter = json_log_formatter.JSONFormatter()

json_handler = logging.FileHandler(filename='/var/log/my-log.json')
json_handler.setFormatter(formatter)

logger = logging.getLogger('my_json')
logger.addHandler(json_handler)

logger.info('Sign up', extra={'referral_code': '52d6ce'})

The log file will contain the following log record (inline):

{
    "message": "Sign up",
    "time": "2015-09-01T06:06:26.524448",
    "referral_code": "52d6ce"
}

Django integration

JSON libs

Help to deal with Decimal.

ujson simplejson json

Tests

$ pip install -r requirements.txt
$ tox

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

JSON-log-formatter-0.0.1.tar.gz (1.9 kB view details)

Uploaded Source

File details

Details for the file JSON-log-formatter-0.0.1.tar.gz.

File metadata

File hashes

Hashes for JSON-log-formatter-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ac134a88de0f0e527deab0c729bc3255cc73f40a53ce99efccf89a53b844cda5
MD5 7a1332e67cb6eb1c5b8768ef61270618
BLAKE2b-256 8d39008311a80cc948b314e9473443e9e5408e8794c0043daa5306115ee938eb

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