Skip to main content

log-json-fmt

python logging json formatter.

Installation

$ pip install logjsonfmt

---> 100%

Example

Create it

  • Create a file example.py with:
import logging
import logjsonfmt

logger = logging.getLogger()
logHandler = logging.StreamHandler()
formatter = logjsonfmt.JSONFormatter(hostname="app.example.com", indent=True)
logHandler.setFormatter(formatter)
logger.addHandler(logHandler)
logger.error('hello world!', extra={"tags": ["app=helloworld"]})

Out:

{
 "@timestamp": "2021-05-27 03:03:01.745983 +00:00",
 "app_host_name": "app.example.com",
 "logger_name": "root",
 "level": "ERROR",
 "pathname": ".\\example.py",
 "lineno": 17,
 "func_name": "<module>",
 "thread_id": 30612,
 "thread_name": "MainThread",
 "process_id": 7356,
 "process_name": "MainProcess",
 "message": "hello world!",
 "tags": [
  "app=helloworld"
 ]
}

Metadata

Release files for logjsonfmt 0.0.2

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

Source distribution (sdist)

Source distribution for logjsonfmt 0.0.2
File Size Uploaded Provenance
logjsonfmt-0.0.2.tar.gz 3.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for logjsonfmt 0.0.2
File Interpreter ABI Platform
logjsonfmt-0.0.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 7.1 kB

Release files / logjsonfmt-0.0.2.tar.gz

Download URL logjsonfmt-0.0.2.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
79470cab4ab6265ad5a8104bbf43192a563d861c927615fe853382c83a507421
BLAKE2b-256 checksum
How to use checksums
de861faf00a3aa58d659c273760fbf9525d8db9473f74d8d44e924a4e88f8423
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.24.0

Release files / logjsonfmt-0.0.2-py2.py3-none-any.whl

Download URL logjsonfmt-0.0.2-py2.py3-none-any.whl
Size 3.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
026d470b567327114b0bbe6730ca4713094ac54eb0ae3ccafd49597f4d956470
BLAKE2b-256 checksum
How to use checksums
980c4a2bba0ea31cac7b4794d42d3e1eed6f93d3c7c20da62f6f2ae19736ed8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.24.0

Security for logjsonfmt 0.0.2

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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