Datadog Custom Logger
Usage
Steps
-
Install pip package
pip install datadog-custom-logger
-
Import package
from datadog_custom_logger import DatadogCustomLogHandler
-
Initialize the handler
datadog_custom_handler = DatadogCustomLogHandler(level=logging.INFO)
💡Note: if the level is set to logging.WARNING, you won't be able to see info or debug level logs.
Hierarchy:
- debug (logging.DEBUG)
- info (logging.INFO)
- warning (logging.WARNING)
- error (logging.ERROR)
-
Attach the handler
logging.basicConfig() logger = logging.getLogger() logger.addHandler(datadog_custom_handler) logging.getLogger().setLevel(logging.INFO)
-
Now simply log the logs
# This statement won't be logged because the .setLevel() is set to logging.INFO. # Please check the logging hierarchy for more. logging.debug("This is debug level code") # This will be logged as per .setLevel() logging.info("This is info level logs")
Complete example:
Metadata
Release files for datadog-custom-logger 1.1.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 | Provenance | Actions |
|---|---|---|---|---|
| datadog-custom-logger-1.1.1.tar.gz | 3.0 kB | Without provenance | Details for datadog-custom-logger-1.1.1.tar.gz |
Release files / datadog-custom-logger-1.1.1.tar.gz
| Download URL | datadog-custom-logger-1.1.1.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4a8faf8feb7343c0425601517eb99cd2ef5b41e25f655d5a6714165271ba68f
|
|
BLAKE2b-256 checksum How to use checksums |
87c5366de11bb0b405db8896bd4d1883d266744abbd20f6f9eb515d850498845
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10
|
Security for datadog-custom-logger 1.1.1
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.