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.2.0.tar.gz
(2.2 kB
view hashes)
Built Distribution
Close
Hashes for datadog_log-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0185de94dec20be9672d68d31512a1b8b04d61e669bf07a7bc862c6bad2ecfa |
|
MD5 | 6d58c3d631e4baf174d08624b5864382 |
|
BLAKE2b-256 | e44cbde12c0a030efdbe64e23ee01c313b52abdb41a6211050a39196bdc7ed52 |