Skip to main content

Python JSON Formatter

A log formatter for python logging. Based on https://github.com/marselester/json-log-formatter

做了如下更改: message改为logmsg字段, 额外添加了logcreated, logname, loglevel字段

安装

使用pip安装:

pip install Python-JSON-Formatter

使用

例如下面的代码:

logger = logging.getLogger('test')
logger.warn('logger test', extra={'t': datetime.datetime.now().isoformat()})

产生如下格式日志(已格式化,实际一行一条日志):

{
  "t": "2017-11-29T14:53:14.981141",
  "logmsg": "logger test",
  "logcreated": 1511938394.9812107,
  "logname": "test",
  "loglevel": "WARNING"
}
{
  "t": "2017-11-29T14:53:15.949140",
  "logmsg": "logger test",
  "logcreated": 1511938395.9492354,
  "logname": "test",
  "loglevel": "WARNING"
}

Metadata

Release files for Python-JSON-Formatter 0.1.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 Python-JSON-Formatter 0.1.1
File Size Uploaded Provenance Actions
Python-JSON-Formatter-0.1.1.tar.gz 1.9 kB Without provenance Details for Python-JSON-Formatter-0.1.1.tar.gz

Release files / Python-JSON-Formatter-0.1.1.tar.gz

Download URL Python-JSON-Formatter-0.1.1.tar.gz
Size 1.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a6a0f11967611bada3c0ef101096549952ccd0cfd602e5cb38a57c0f7b449d88
BLAKE2b-256 checksum
How to use checksums
b181a0e43ca43dee691933dab70ced232baec5254bcdeb585bcfa484a3a63fbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for Python-JSON-Formatter 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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