Structured JSON logging for OpenTelemetry and New Relic
Project description
Title:
otel-logger: Structured JSON Logging for OpenTelemetry and New Relic
Summary:
otel-logger is a lightweight Python logging package that outputs structured JSON logs compatible with OpenTelemetry and New Relic observability platforms. It simplifies logging by providing a consistent schema for service name, environment, and custom fields, making it ideal for distributed systems and cloud-native applications.
Features:
- ✅ Structured JSON logs for easy ingestion by observability tools.
- ✅ Supports custom fields via
extraparameter. - ✅ Configurable
service.name, log level, and file path. - ✅ Default metadata:
team,vsnfor uniform logging. - ✅ Simple integration with Python’s built-in
loggingmodule.
Example Usage:
import logging
from otel_logger import get_otel_logger
logger = get_otel_logger(
log_file="/app/logs/otel.log",
service_name="Cloud Billing",
level=logging.INFO
)
logger.info("Billing process started", extra={"extra_fields": {"request_id": "12345"}})
Output:
{
"timestamp": "2025-11-25T11:30:00Z",
"level": "INFO",
"message": "Billing process started",
"service.name": "Cloud Billing",
"team": "sse",
"vsn": "v1.0.0",
"request_id": "12345"
}
Installation:
pip install otel-logger
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 otel_logger-1.0.2.tar.gz.
File metadata
- Download URL: otel_logger-1.0.2.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86fdeb46abdded59143f1625381aac4ca50d37bea0043d109e8aa2087de58cf2
|
|
| MD5 |
51f123513882c5d2567970eceb98a274
|
|
| BLAKE2b-256 |
6591ba7399ee2a332e20b08f9c220b83a88d7cdd0ceaeda65987a5611410af5c
|
File details
Details for the file otel_logger-1.0.2-py3-none-any.whl.
File metadata
- Download URL: otel_logger-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50d3c87776b7d638239bf8f6c98796524905e056330ce2dd67be94aa92f1513e
|
|
| MD5 |
439bf6922b5237a2c5937de53c90c38e
|
|
| BLAKE2b-256 |
36c6041a9ac6b413b37a336e076de5d28208663db529f4b82307b7a4f54b67e7
|