Skip to main content

elseware-py

Reusable, typed logging infrastructure for Python applications from Elseware Technology. It builds on Python's standard logging module and has no runtime dependencies.

Importing elseware-py never configures the root logger. Applications opt in by calling configure_logging; libraries can safely use get_logger.

Installation

python -m pip install elseware-py

Text Logging

from elseware_py.logging import (
    LogLevel,
    LoggingConfig,
    configure_logging,
    get_logger,
)

configure_logging(
    LoggingConfig(level=LogLevel.INFO),
    namespace="my_application",
)

logger = get_logger("my_application.worker")
logger.info("Worker started", extra={"worker_id": "worker-1"})

Text records contain an RFC 3339 UTC timestamp, level, logger name, message, and sorted contextual fields.

JSON Logging

from elseware_py.logging import (
    LogFormat,
    LogLevel,
    LoggingConfig,
    configure_logging,
)

configure_logging(
    LoggingConfig(
        level=LogLevel.INFO,
        format=LogFormat.JSON,
    ),
    namespace="my_application",
)

JSON output is newline-delimited and always contains timestamp, level, logger, and message. Context, exception details, and source information are included when available.

Context and Exceptions

from elseware_py.logging import get_logger, log_context

logger = get_logger("my_application.jobs")

with log_context(request_id="req-123", job="sync"):
    logger.info("Job started")

    try:
        raise RuntimeError("connection failed")
    except RuntimeError:
        logger.exception("Job failed")

Nested contexts restore previous values automatically. Values passed through extra override matching context fields for that record.

Redaction

Structured fields with common secret names such as password, token, authorization, and api_key are replaced with [REDACTED], including nested mappings.

Redaction applies to structured context only. Secrets embedded inside a log message cannot be detected safely and must never be included by application code.

Development

Create and activate a virtual environment:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install --editable . --group dev

On Windows, activate with:

.venv\Scripts\activate

Run validation:

ruff check .
ruff format --check .
mypy
pytest --cov --cov-report=term-missing

Build

python -m build
twine check --strict dist/*

The build creates:

dist/elseware_py-<version>-py3-none-any.whl
dist/elseware_py-<version>.tar.gz

Publish to PyPI

Update __version__ in src/elseware_py/__about__.py, run the complete validation, build clean artifacts, and upload them manually:

twine upload dist/*

PyPI release files are immutable. Increment the version before publishing a corrected release.

License

MIT License

Metadata

Release files for elseware-py 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 elseware-py 1.0.0
File Size Uploaded Provenance Actions
elseware_py-1.0.0.tar.gz 9.0 kB Without provenance Details for elseware_py-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for elseware-py 1.0.0
File Interpreter ABI Platform Actions
elseware_py-1.0.0-py3-none-any.whl Python 3 none any Details for elseware_py-1.0.0-py3-none-any.whl

Total release size: 17.3 kB

Release files / elseware_py-1.0.0.tar.gz

Download URL elseware_py-1.0.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9bb23133ce65fe82e35146d7cda686da242ed6a00a0815a7ac0008f0b3b569a3
BLAKE2b-256 checksum
How to use checksums
cbec5f879434f6578a87b18752be9b0ac9b5ebf3dbe77da271491ef81865976b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / elseware_py-1.0.0-py3-none-any.whl

Download URL elseware_py-1.0.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d95fb66d1fdd9a846054387bed542310e84206fbd2f00e27017c5a9928efd563
BLAKE2b-256 checksum
How to use checksums
c1b36290de27e6c2537f7d7277cf67e8ddc67aba65f8c5b3973191f1e4867c85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for elseware-py 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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 No 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