A professional logging module using Azure Table Storage
Project description
Masterzdran Azure Table Storage Logging
mz-logging-azure-tablestorage
A professional Python logging module that uses Azure Table Storage for structured logging with support for trace IDs, metadata, and different log levels.
Features
- Asynchronous logging using Azure Table Storage
- Structured logging with comprehensive metadata
- Trace ID support for request tracking
- Automatic caller location tracking
- Configurable log levels (DEBUG, INFO, WARNING, ERROR, CRITICAL)
- Dependency injection for flexible storage backends
- Full type hinting support
- Comprehensive test coverage
Installation
Install the package using pip:
pip install mz-logging-azure-tablestorage==1.0.0
For development installation:
pip install -e .[dev]
Quick Start
from mz_logging_azure_tablestorage import AzureLogger
from mz_logging_azure_tablestorage.storage import AzureTableStorage
# Initialize the storage
storage = AzureTableStorage(
connection_string="your_azure_connection_string",
table_name="logs"
)
# Create a logger instance
logger = AzureLogger(
storage=storage,
logger_name="my_service"
)
# Log messages with different levels
await logger.info("Operation completed",
metadata={"user_id": "123", "action": "login"})
await logger.error("Operation failed",
trace_id="custom-trace",
metadata={"error_code": "AUTH001"})
Configuration
The logger can be configured with the following parameters:
logger = AzureLogger(
storage=storage,
logger_name="my_service",
default_trace_id="custom-default-trace" # Optional
)
Log Levels
- DEBUG: Detailed information for debugging
- INFO: General information about program execution
- WARNING: Indicates a potential problem
- ERROR: A more serious problem
- CRITICAL: A critical problem that may prevent program execution
Development
Setup Development Environment
- Clone the repository:
git clone git@github.com:masterzdran/mz-logging-azure-tablestorage.git
cd mz-logging-azure-tablestorage
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install development dependencies:
pip install -e .[dev]
Running Tests
Run the test suite:
pytest
Run with coverage:
pytest --cov=src --cov-report=html
Code Quality
Run code quality checks:
black . # Code formatting
isort . # Import sorting
pylint src/ tests/ # Linting
mypy src/ # Type checking
Building the Package
- Install build dependencies:
pip install build wheel
- Build the package:
python -m build
Publishing
- Install publishing dependencies:
pip install twine
- Upload to PyPI:
twine upload dist/*
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
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 mz_logging_azure_tablestorage-1.0.0.tar.gz.
File metadata
- Download URL: mz_logging_azure_tablestorage-1.0.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ca3e7527e53c5de708a57fe21920f27674842e14d48b817954593eb1aae30e1
|
|
| MD5 |
e227ab31ab4e5b6bcc9950e32f4bc1f1
|
|
| BLAKE2b-256 |
6933abdfeea51217f79a7e4a4b67fe92dec61e994e9157671fec58e9d2a32dce
|
Provenance
The following attestation bundles were made for mz_logging_azure_tablestorage-1.0.0.tar.gz:
Publisher:
main.yml on masterzdran/mz-logging-azure-tablestorage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mz_logging_azure_tablestorage-1.0.0.tar.gz -
Subject digest:
9ca3e7527e53c5de708a57fe21920f27674842e14d48b817954593eb1aae30e1 - Sigstore transparency entry: 164793736
- Sigstore integration time:
-
Permalink:
masterzdran/mz-logging-azure-tablestorage@2bc63f36667e83eb44db39cdfd4dc5e84baefd3e -
Branch / Tag:
refs/tags/release/v1.0.0 - Owner: https://github.com/masterzdran
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@2bc63f36667e83eb44db39cdfd4dc5e84baefd3e -
Trigger Event:
push
-
Statement type:
File details
Details for the file mz_logging_azure_tablestorage-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mz_logging_azure_tablestorage-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0eb515780bc4d0307ae45f057e186d53c3c58f3d3f23401fd88946426aea4d30
|
|
| MD5 |
84551bc661ee15336c2a567ec91421c5
|
|
| BLAKE2b-256 |
76f29882433c195a27d0b76936d60a66fd58572343dc17c757041542f29df975
|
Provenance
The following attestation bundles were made for mz_logging_azure_tablestorage-1.0.0-py3-none-any.whl:
Publisher:
main.yml on masterzdran/mz-logging-azure-tablestorage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mz_logging_azure_tablestorage-1.0.0-py3-none-any.whl -
Subject digest:
0eb515780bc4d0307ae45f057e186d53c3c58f3d3f23401fd88946426aea4d30 - Sigstore transparency entry: 164793739
- Sigstore integration time:
-
Permalink:
masterzdran/mz-logging-azure-tablestorage@2bc63f36667e83eb44db39cdfd4dc5e84baefd3e -
Branch / Tag:
refs/tags/release/v1.0.0 - Owner: https://github.com/masterzdran
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@2bc63f36667e83eb44db39cdfd4dc5e84baefd3e -
Trigger Event:
push
-
Statement type: