Metadata-Version: 2.4
Name: azappinsights-logger
Version: 0.0.8
Summary: A simple logging utility for sending logs to azure application insights using AzureLogHandler
Author-email: Ranti Familusi <ranti.familusi@ibm.com>
Project-URL: Homepage, https://dev.azure.com/IBM-CA-MSPRACTICE/Maximo-Copilot/_git/utilities/az-app-insight-logger
Project-URL: Bug Tracker, https://dev.azure.com/IBM-CA-MSPRACTICE/Maximo-Copilot/_workitems/edit/146
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: python-dotenv
Requires-Dist: azure-monitor-opentelemetry
Requires-Dist: opentelemetry-sdk
Dynamic: license-file

# 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

```bash
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.

```python
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
