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"
}
}
Metadata
Release files for datadog-log 1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| datadog_log-1.5.1.tar.gz | 3.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| datadog_log-1.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.1 kB
Release files / datadog_log-1.5.1.tar.gz
| Download URL | datadog_log-1.5.1.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff73fe63a93202d2d52b64983bc2e4a15c79b5ef7e4a7462123021cec80b27fd
|
|
BLAKE2b-256 checksum How to use checksums |
5155cfbd758155a8986fc778150c3fcd28c6a45b2b740e93430bde4133dca278
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0
|
Release files / datadog_log-1.5.1-py3-none-any.whl
| Download URL | datadog_log-1.5.1-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
860388819048234aa217d8f7da3ca635a2894c2bfa16e0f0319332eb27955970
|
|
BLAKE2b-256 checksum How to use checksums |
81462ace21d29964d2bf27784cc91b1799a7d7117f4d442519286c2c636ab873
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0
|