Logger Tool for Datadog logs monitoring
Project description
Datadog Custom Logger
Usage
Steps
-
Install pip package
pip install datadog-custom-logger==0.1.0
-
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:
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
Close
Hashes for datadog-custom-logger-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 040990d676c5280d04a9c25bf5d6b0226c42fef520555e2e83209d56583d8503 |
|
MD5 | 29775a326f1018696172a3724312e35e |
|
BLAKE2b-256 | 9569e6b6b8dd72c6fd75611d999820c42d263be0f245b1735dc47efb8211042d |