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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file JSON-log-formatter-0.0.1.tar.gz
.
File metadata
- Download URL: JSON-log-formatter-0.0.1.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac134a88de0f0e527deab0c729bc3255cc73f40a53ce99efccf89a53b844cda5 |
|
MD5 | 7a1332e67cb6eb1c5b8768ef61270618 |
|
BLAKE2b-256 | 8d39008311a80cc948b314e9473443e9e5408e8794c0043daa5306115ee938eb |