Skip to main content

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

  1. Clone the repository:
git clone git@github.com:masterzdran/mz-logging-azure-tablestorage.git
cd mz-logging-azure-tablestorage
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. 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

  1. Install build dependencies:
pip install build wheel
  1. Build the package:
python -m build

Publishing

  1. Install publishing dependencies:
pip install twine
  1. Upload to PyPI:
twine upload dist/*

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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)

Source distribution for mz-logging-azure-tablestorage 1.0.0
File Size Uploaded Provenance
mz_logging_azure_tablestorage-1.0.0.tar.gz 9.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mz-logging-azure-tablestorage 1.0.0
File Interpreter ABI Platform
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 log

Release 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 log

Security 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.

Select from 2 files

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 log

A 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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page