Skip to main content

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

Release files for JSON-log-formatter 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for JSON-log-formatter 0.0.1
File Size Uploaded
JSON-log-formatter-0.0.1.tar.gz 1.9 kB Details

Release files / JSON-log-formatter-0.0.1.tar.gz

Download URL JSON-log-formatter-0.0.1.tar.gz
Size 1.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ac134a88de0f0e527deab0c729bc3255cc73f40a53ce99efccf89a53b844cda5
BLAKE2b-256 checksum
How to use checksums
8d39008311a80cc948b314e9473443e9e5408e8794c0043daa5306115ee938eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.2.1

2 release files

1.1.1

1 release file

1.1

1 release file

1.0

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

2 release files

0.1.0

1 release file

0.0.2

1 release file

This release

0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page