Skip to content

plughacker/pytelemety

Repository files navigation

pytelemetry

A simple and default open telemetry log formatter

Quick Start

  • Install
pip install git+https://github.com/plughacker/[email protected]
  • Create an env var
NEW_RELIC_APP_NAME=your_project_name
NEW_RELIC_ENVIRONMENT=development | production | None
SERVICE_VERSION=0.0.1
LOGGER_SAVE_TO_FILE=True | False # When True salve logs in app.
LOGGER_LEVEL=DEBUG

or

SERVICE_NAME=your_project_name
SERVICE_ENVIRONMENT=development | production | None
SERVICE_VERSION=0.0.1
LOGGER_SAVE_TO_FILE=True | False # When True salve logs in app.log file
  • Import in your project
from pytelemetry import create_logger

logger = create_logger('My Controller') # returns default python logger

logger.error('division by zero')

Output

{"Timestamp": 1698414960, "TraceId": "a0909332-03a7-4ff5-84b1-7373793042ce", "SeverityText": "ERROR", "SeverityNumber": 17, "Body": "division by zero", "Resource": {"service_name": "service_not_named", "service_version": "0.0.1", "service_environment": null}, "InstrumentationScope": "Class or mehtod name", "Attributes": []}

Baseado em

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published