JSON formatted logging for Datadog
Project description
Datadog-log
Write out JSON formatted logs in the format and with the attributes 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"]})
The above would output json like below (but as a single line, shown 'pretty' here for readability):
{
"message": "Some info",
"extra": ["json"],
"timestamp": "2021-09-18T21:14:07.707371+00:00",
"status": "info",
"logger": {
"name": "example",
"method_name": "<stdin>.<module>",
"thread_name": "MainThread"
}
}
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datadog_log-1.5.1.tar.gz.
File metadata
- Download URL: datadog_log-1.5.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff73fe63a93202d2d52b64983bc2e4a15c79b5ef7e4a7462123021cec80b27fd
|
|
| MD5 |
939e07e9ff202a62536970a0ef2d1020
|
|
| BLAKE2b-256 |
5155cfbd758155a8986fc778150c3fcd28c6a45b2b740e93430bde4133dca278
|
File details
Details for the file datadog_log-1.5.1-py3-none-any.whl.
File metadata
- Download URL: datadog_log-1.5.1-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
860388819048234aa217d8f7da3ca635a2894c2bfa16e0f0319332eb27955970
|
|
| MD5 |
655bfe48d0343dbca64db878a668746b
|
|
| BLAKE2b-256 |
81462ace21d29964d2bf27784cc91b1799a7d7117f4d442519286c2c636ab873
|