Skip to main content

xlogging

A lightweight extension on top of Python's built-in logging module. Structured, readable output for local dev and production services.

What it solves

stdlib logging emits flat, hard-to-read text. When a log record carries nested context — request metadata, exception details, tags — there's no clean way to display or store it. xlogging adds structured formatters and a first-class LogEvent record so that context travels with the message.

Key features

  • TreeFormat / ColorTreeFormat — renders nested dicts and lists as a Unicode tree, readable in terminal
  • JsonFormat — emits newline-delimited JSON for file storage and log aggregators
  • EventStream — a Logger subclass that accepts metadata and tags per call, and supports per-logger timezone
  • LogEvent — a LogRecord subclass with created_at, metadata, and tags fields
  • FileGroup — rotating file handler that defaults to JSON format
  • ConsoleGroup — stream handler with pluggable formatter

Usage

from xlogging import EventStream, ColorTreeFormat, ConsoleGroup

stream = EventStream.from_options(
    name="app",
    handlers=[ConsoleGroup(format=ColorTreeFormat())],
)

stream.info(
    "order filled",
    metadata={"symbol": "AAPL", "qty": 100, "price": 189.5},
    tags={"strategy": "momentum"},
)

stream.error(
    "execution failed",
    metadata={"order_id": "x-001", "reason": "insufficient margin"},
)

Terminal output:

[2026-08-31 09:00:00][INFO]: order filled
    ├── metadata:
    │   ├── symbol: AAPL
    │   ├── qty: 100
    │   └── price: 189.5
    └── tags:
        └── strategy: momentum

File handler

from xlogging import EventStream, FileGroup

stream = EventStream.from_options(
    name="app",
    handlers=[FileGroup(path="logs/", name="app")],
)

Writes rotating JSON logs to logs/app.log (10 MB per file, 1 backup by default).

Install

pip install lib-x-xlogging

Requires Python 3.11+. Runtime dependency: colorlog.

Metadata

Release files for lib-x-xlogging 1.7

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

Source distribution (sdist)

Source distribution for lib-x-xlogging 1.7
File Size Uploaded Provenance Actions
lib_x_xlogging-1.7.tar.gz 20.4 kB Without provenance Details for lib_x_xlogging-1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lib-x-xlogging 1.7
File Interpreter ABI Platform Actions
lib_x_xlogging-1.7-py3-none-any.whl Python 3 none any Details for lib_x_xlogging-1.7-py3-none-any.whl

Total release size: 50.6 kB

Release files / lib_x_xlogging-1.7.tar.gz

Download URL lib_x_xlogging-1.7.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
22b5db3b752a95e184a6ee31d84f26270b7bd318ae3ded4edc166754a3abe014
BLAKE2b-256 checksum
How to use checksums
cd50349a4483d7aadb167f2641a0aecc3ae0c5a3f41d12cccfdc3126f0387c9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / lib_x_xlogging-1.7-py3-none-any.whl

Download URL lib_x_xlogging-1.7-py3-none-any.whl
Size 30.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47565bbe1be69c30aff0e68f8d68b675f4d403c344f465206b8cd3db9adfd221
BLAKE2b-256 checksum
How to use checksums
685026d72d38a405f693f6f2e9ae8f2749baf245b9b42a280c308b116e076697
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Security for lib-x-xlogging 1.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.

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.

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