Internal structured logging utility for ECL microservices
Project description
Structured Logging Utilities for ECL microservices
Internal package for consistent structured logging across ECL microservices. Features JSON formatting, automatic metadata capture, and environment-based configuration. Utility will also handle pushing logs to OpenSearch if the OpenSearch related environment variables are set.
Features
- 📝 Structured JSON logs with consistent schema
- 🕒 Automatic timestamping in ISO 8601 format
- 📍 Complete source location (file path, line number, module, function)
- 🔍 Query-ready fields (transaction_id, request_ip, service_name)
- ⚙️ Environment-controlled log levels
- 🔗 Request context propagation across services
- ☁️ Push logs to OpenSearch enterprise-grade search and observability suite that brings order to unstructured data at scale.
- 👖 Push error and critical logs to Slack
- 🛡 Private package for internal use of ECL
Environment Variables
- ECL_LOGGING_UTILITY_LOG_LEVEL: Set the log level, default: INFO
- ECL_LOGGING_UTILITY_APP_VERSION: Denotes the app version which will be displayed in the log, default: AMBIVALENT_APP_VERSION
- ECL_LOGGING_UTILITY_SERVICE_NAME: Denotes the service name which will be displayed in the log, default: AMBIVALENT_SERVICE_NAME
- ECL_LOGGING_UTILITY_OPENSEARCH_ENABLED: Flag to enable/disable pushing logs to OpenSearch endpoint, default: False
- ECL_LOGGING_UTILITY_OPENSEARCH_HOST: OpenSearch endpoint's host, default: localhost
- ECL_LOGGING_UTILITY_OPENSEARCH_PORT: OpenSearch endpoint's port, default: 9200
- ECL_LOGGING_UTILITY_OPENSEARCH_USERNAME: Basic Auth username, default: None
- ECL_LOGGING_UTILITY_OPENSEARCH_PASSWORD: Basic Auth password, default: None
- ECL_LOGGING_UTILITY_SLACK_WEBHOOK_URL: Webhook URL of Slack channel to push notification in case of
error&criticallogs - ECL_LOGGING_UTILITY_INDEX_PATTERN_UUID: UUID of the OpenSearch index pattern with which the log is discovered. It is used to generate the OpenSearch dashboard link.
Installation
pip install ecl-logging-utility
Usage
from ecl_logging_utility import logger
logger.info("You have hit heartbeat", custom_1="1234", custom_2=500.0)
Version History
See CHANGELOG.md for release notes.
Project details
Release history Release notifications | RSS feed
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 ecl_logging_utility-1.0.13.tar.gz.
File metadata
- Download URL: ecl_logging_utility-1.0.13.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44114bc62c325346da2fe8954736b7f5a49ce98b92f51e48abd89c13dc780e21
|
|
| MD5 |
33af44d9cb4ba1ea91cec6a7ece5f804
|
|
| BLAKE2b-256 |
8bf9d80e145d0f69392d76128ae6161c0641da32a1ff5687b2a12cc537eec589
|
File details
Details for the file ecl_logging_utility-1.0.13-py3-none-any.whl.
File metadata
- Download URL: ecl_logging_utility-1.0.13-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97cded2cd3b32f89ebf7f041cb88421968dac2c17e2cc743e89ed4318cd1e2e0
|
|
| MD5 |
933fe3aed5a83675e75e999f14336fc8
|
|
| BLAKE2b-256 |
29147f97a05c249b81f799387f27d674e13c24528a936735a0677632493c2938
|