Skip to main content

A simple logging utility for sending logs to azure application insights using AzureLogHandler

Project description

Azure App Insights Logger

A simple logging utility for python application that provides consistent logging setup across different modules using AzureLogHandler. Log will also be streamted to the console.

Installation

pip install azappinsights-logger --upgrade (prod)
pip install --index-url https://test.pypi.org/simple/  azappinsights-logger --upgrade (non prod)

The --upgrade is only required if you are installing an upgraded version of the package

Depdencies opentelemetry-sdk, azure-monitor-opentelemetry and python-dotenv should be installed with the package.

Usage

Create an environment variable with the name APPLICATIONINSIGHTS_CONNECTION_STRING and pass the value for app insights connections string.

from azappinsights_logger.logger import setup_logger

# Create a logger with default settings
logger = setup_logger("my.module")

# Create a logger with custom level
logger = setup_logger("my.module", level=logging.DEBUG)

# Use the logger
logger.info("This is an info message")
logger.debug("This is a debug message")
logger.error("This is an error message")

Features

  • Consistent logging format across all modules
  • Simple setup with sensible defaults
  • Customizable log levels and formats
  • Thread-safe logging configuration

License

This project is licensed under the MIT License

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

azappinsights_logger-0.0.8.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

azappinsights_logger-0.0.8-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file azappinsights_logger-0.0.8.tar.gz.

File metadata

  • Download URL: azappinsights_logger-0.0.8.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for azappinsights_logger-0.0.8.tar.gz
Algorithm Hash digest
SHA256 1ddcf1695333bac4ba7ab31885137e91eb17edff9148a618ef285a9335469e6d
MD5 186757b30e8fd6addccaf7f7e292d02a
BLAKE2b-256 83af5f05a3780b9e18979de293cbdbee60b7cf2f36291c03cab3821b3a4a5541

See more details on using hashes here.

File details

Details for the file azappinsights_logger-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for azappinsights_logger-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 5351d8fa192064ce8915202f7a3f43f32043d8dab810b314c86f9c19d503c874
MD5 a65412e03b4a0601530532a010296366
BLAKE2b-256 9bfbd098905923414653a2b06662651aef8fdb57db65d5fa847b5348117de8cf

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