Logging library that tells you why it happened
Project description
logxpy is a Python logging library that outputs structured, actionable logs tracing causal chains of actions—helping you understand why things happened in your application.
Why logxpy?
Python’s built-in logging and similar systems output a stream of factoids: they’re interesting, but hard to trace.
Why is your application slow?
What caused this code path to be chosen?
Why did this error happen?
Standard logging can’t answer these questions easily.
With logxpy, you get causal chains of actions: actions can spawn other actions, and eventually they either succeed or fail. The resulting logs tell you the story of what your software did.
Features
Structured Logging - JSON output for easy parsing and analysis
Action Tracing - Track operations from start to finish with timing
Hierarchical Tasks - Nested actions show the full call chain
Python 3.12+ Ready - Built with modern Python features
Async Support - Works with asyncio and async/await patterns
Type Safety - Full type hints throughout
Quick Start
Install logxpy:
pip install logxpy
Basic usage:
from logxpy import start_action, Message, to_file
# Output to a file
to_file(open("app.log", "w"))
# Log messages
Message.log(message_type="app:startup", version="1.0.0")
# Trace actions
with start_action(action_type="http:request", method="POST", path="/api/users"):
with start_action(action_type="database:query", table="users"):
Message.log(message_type="database:result", rows=10)
Output is structured JSON that’s easy to parse, visualize, and analyze.
Viewing Logs
Use the companion logxpy-cli-view package to render logs as beautiful colored trees:
pip install logxpy-cli-view logxpy-cli-view app.log
Or use the standalone viewer from the examples:
python examples-log-view/view_tree.py app.log
Requirements
Python 3.9 or newer (including PyPy3)
Links
License
Apache 2.0 License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logxpy-0.2.1.tar.gz.
File metadata
- Download URL: logxpy-0.2.1.tar.gz
- Upload date:
- Size: 195.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1e03c4d19cbcdd5ce2e21fce86bffa29da27846f0fe50f3b526c2d914daada5
|
|
| MD5 |
930a34aff6bd6facf53c48ac5ce3caa2
|
|
| BLAKE2b-256 |
0bf967fa4dbfdd62d22d35a41593d2392cd5bbb8135112db6933d718779743d3
|
File details
Details for the file logxpy-0.2.1-py3-none-any.whl.
File metadata
- Download URL: logxpy-0.2.1-py3-none-any.whl
- Upload date:
- Size: 132.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a488083a2279142eca258f633a4472279c2ed2dd2cf2c78c4056ee7b1f625b62
|
|
| MD5 |
c5128f948d5d8fa74032e42abaa649c5
|
|
| BLAKE2b-256 |
caa364f5d70ad2a0e95a8cb55d4b6245b1a319e84bdfa01a1a04c5d189228db6
|