Skip to main content

Internal structured logging utility for ECL microservices

Project description

Structured Logging Utilities for ECL microservices

Python Version License

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 & critical logs
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ecl_logging_utility-1.0.17.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ecl_logging_utility-1.0.17-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file ecl_logging_utility-1.0.17.tar.gz.

File metadata

  • Download URL: ecl_logging_utility-1.0.17.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for ecl_logging_utility-1.0.17.tar.gz
Algorithm Hash digest
SHA256 1ceeff5ebe454c09f84bec330a3bf80c4b4e41212c3ca4a86f23f6f2457666b7
MD5 e46da3a1b8b64b3cf37a2e3fc205d43b
BLAKE2b-256 59ecb2c3dcff62abf0637e087caf4517dd017951c0327b7243766dd66cf5f9c7

See more details on using hashes here.

File details

Details for the file ecl_logging_utility-1.0.17-py3-none-any.whl.

File metadata

File hashes

Hashes for ecl_logging_utility-1.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 13a41ee5cecd81376aa28bcc74b577c4fcb0347105154d6561688a49bf453508
MD5 093a473f13bc49b043e94d395c647dfb
BLAKE2b-256 0f95140eb1ad0e0580348e93630e5e73f30eab1cc41e2c9a3ccff09636c29d71

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page