JSON formatted logging for Datadog
Project description
Datadog-log
Write out JSON formatted logs in the format that Datadog expects
Installation
pip install datadog-log
Setup
The simplest way is to use init_logging()
which will log to stdout.
If you want finner control then you can use DatadogFormatter
directly.
See init_logging
for example usage.
Logging
Use logging as normal:
import logging
import datadoglog
datadoglog.init_logging()
log = logging.getLogger("example")
log.setLevel(logging.INFO)
log.info("Some info", extra={"extra": "json"})
# Outputs {"message": "Some info", "extra": "json", "timestamp": "2021-02-02T19:11:12.716126+00:00", "status": "info", "logger": {"name": "example"}}
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
datadog-log-1.1.0.tar.gz
(2.2 kB
view hashes)
Built Distribution
Close
Hashes for datadog_log-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82342a0f9f7cedf4fc00485932ecf0bb478a2f5cb1269ca995633307287e9b0d |
|
MD5 | 31e4f0adc112dea7eb45031bf712f7f5 |
|
BLAKE2b-256 | 9e82bdfe28624255741097caf0697cfeafb4a04292208abefa2035a2bb074c0f |