kitstructlog
A superstructure over structlog that simplifies the configuration and use of structured logging in Python.
✨ Features
- Simple declaration of project loggers via
dataclass-like syntax - Automatic setup of
logging+structlog - Developer-friendly console output or JSON structured logs (depending on mode)
- Extensible processors chain (timestamps, stack info, caller details, etc.)
- Support for multiple named loggers in one place
📦 Installation
pip install kitstructlog
🚀 Quick Start
Basic usage
import structlog
from kitstructlog import InitLoggers, LoggerReg
class Loggers(InitLoggers):
app = LoggerReg(name="APP", level=LoggerReg.Level.INFO)
db = LoggerReg(name="DATABASE", level=LoggerReg.Level.DEBUG)
# Initialize
loggers = Loggers(developer_mode=True)
# Use logger
logger = structlog.getLogger(Loggers.app.name)
logger.info("Application started", version="1.0.0")
JSON logging
import structlog
from kitstructlog import InitLoggers, LoggerReg
class Loggers(InitLoggers):
app = LoggerReg(name="APP", level=LoggerReg.Level.INFO)
access = LoggerReg(name="ACCESS", level=LoggerReg.Level.INFO)
# developer_mode=False => JSON output
loggers = Loggers(developer_mode=False)
logger = structlog.getLogger(Loggers.access.name)
logger.info("Request handled", status=200, path="/login")
Example JSON output:
{
"timestamp": "2025-09-21 03:09:46",
"level": "info",
"logger": "json_logging:logger:14",
"_msg": "Request handled",
"status": 200,
"path": "/login"
}
Multiple loggers
import structlog
from kitstructlog import InitLoggers, LoggerReg
class Loggers(InitLoggers):
auth = LoggerReg(name="AUTH", level=LoggerReg.Level.DEBUG)
router = LoggerReg(name="ROUTER", level=LoggerReg.Level.INFO)
utils = LoggerReg(name="UTILS", level=LoggerReg.Level.DEBUG)
loggers = Loggers(developer_mode=True)
auth_logger = structlog.getLogger(Loggers.auth.name)
auth_logger.debug("Checking token", token="abc123")
router_logger = structlog.getLogger(Loggers.router.name)
router_logger.info("New request", path="/api/v1/resource")
📜 License
MIT License — see LICENSE for details.
Metadata
Release files for kitstructlog 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kitstructlog-0.1.2.tar.gz | 6.2 kB | Without provenance | Details for kitstructlog-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kitstructlog-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for kitstructlog-0.1.2-py3-none-any.whl |
Total release size: 11.9 kB
Release files / kitstructlog-0.1.2.tar.gz
| Download URL | kitstructlog-0.1.2.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5e5395a05eaeba2481d8e7bc3ae4c1554051e561945ca4397f47273aee417f0
|
|
BLAKE2b-256 checksum How to use checksums |
e90a146b5791553e617291ef65f24f1afe3cda20f56391ce0ce945ac28edeaa2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / kitstructlog-0.1.2-py3-none-any.whl
| Download URL | kitstructlog-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1b3b8d360011413162b64bc787c8f108d5c99bc4940e3ef4c7e0d7e253815a2
|
|
BLAKE2b-256 checksum How to use checksums |
3ef970f6360e3a8c109615ae8498b76da52e15a325d4bad4d6208ccf7024b9a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for kitstructlog 0.1.2
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.