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
Metadata
Release files for mz-logging-azure-tablestorage 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mz_logging_azure_tablestorage-1.0.0.tar.gz | 9.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mz_logging_azure_tablestorage-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.7 kB
Release files / mz_logging_azure_tablestorage-1.0.0.tar.gz
| Download URL | mz_logging_azure_tablestorage-1.0.0.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ca3e7527e53c5de708a57fe21920f27674842e14d48b817954593eb1aae30e1
|
|
BLAKE2b-256 checksum How to use checksums |
6933abdfeea51217f79a7e4a4b67fe92dec61e994e9157671fec58e9d2a32dce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 23, 2025.
Transparency logRelease files / mz_logging_azure_tablestorage-1.0.0-py3-none-any.whl
| Download URL | mz_logging_azure_tablestorage-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0eb515780bc4d0307ae45f057e186d53c3c58f3d3f23401fd88946426aea4d30
|
|
BLAKE2b-256 checksum How to use checksums |
76f29882433c195a27d0b76936d60a66fd58572343dc17c757041542f29df975
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 23, 2025.
Transparency logSecurity for mz-logging-azure-tablestorage 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mz_logging_azure_tablestorage-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 23, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.