Skip to main content

albeorla-logging

Opinionated, reusable structlog configuration for Python applications. Get structured logging with sensible defaults in two lines of code.

Features

  • JSON or console output -- switch between machine-readable JSON and human-friendly colored console output with a single flag
  • ISO 8601 UTC timestamps -- every log event is stamped automatically
  • event -> message renaming -- JSON output uses message instead of event for compatibility with log aggregators (Datadog, ELK, etc.)
  • Bound context -- attach key-value context (service name, component, request ID) to a logger once; it appears on every subsequent event
  • stdlib integration -- configures Python's logging alongside structlog so third-party library logs are captured too

Install

pip install "albeorla-logging @ git+ssh://git@github.com/albeorla/albeorla-logging.git"

Or pin to a version:

pip install "albeorla-logging @ git+ssh://git@github.com/albeorla/albeorla-logging.git@v0.1.0"

With uv:

uv add "albeorla-logging @ git+ssh://git@github.com/albeorla/albeorla-logging.git"

Quick start

import logging
from albeorla_logging import configure_logging, get_logger

# Call once at startup
configure_logging(json_output=True, level=logging.INFO)

# Get a logger with optional bound context
log = get_logger(__name__, component="api")

log.info("service_started", port=8080)
# => {"message": "service_started", "component": "api", "port": 8080, "level": "info", "timestamp": "2026-03-20T12:00:00Z", ...}

Console output

configure_logging(json_output=False, level=logging.DEBUG)
log = get_logger("myapp")
log.debug("ready")
# => 2026-03-20T12:00:00Z [debug] ready  logger_name=myapp

API

configure_logging(json_output=False, level=logging.INFO)

Configure structlog and stdlib logging for the process. Call once at application startup.

Parameter Type Default Description
json_output bool False Emit JSON (True) or colored console output (False)
level int logging.INFO Minimum log level

get_logger(name=None, **initial_context)

Return a structlog.stdlib.BoundLogger. Any keyword arguments are permanently bound as context.

Parameter Type Default Description
name str | None None Logger name (typically __name__)
**initial_context Any -- Key-value pairs bound to every log event

Requirements

  • Python >= 3.10
  • structlog >= 24.1.0

License

MIT

Release files for albeorla-logging 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for albeorla-logging 0.1.1
File Size Uploaded
albeorla_logging-0.1.1.tar.gz 3.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for albeorla-logging 0.1.1
File Interpreter ABI Platform
albeorla_logging-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 kB

Release files / albeorla_logging-0.1.1.tar.gz

Download URL albeorla_logging-0.1.1.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8a603a9a06a9c6411eb58d9962174e6c9f91c8e6410852dcfa8999e7941a6e27
BLAKE2b-256 checksum
How to use checksums
2a7102cbc3a4347e82b3a6547a3733b61a8c2a35f406e87bd9e66329f15a247c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 21, 2026.

Transparency log

Release files / albeorla_logging-0.1.1-py3-none-any.whl

Download URL albeorla_logging-0.1.1-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cff60386636b21a8432a651b15ccd53ebe2b93321c389de920fa0fc8e8137dd5
BLAKE2b-256 checksum
How to use checksums
939343afc9821272fdbd8a9c68f48d907d657333e735f78e9f47fc5e2de7b182
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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