This release is a pre-release and may not be stable for production use.
Log-Schema
This logging utility library utilizes python's standard logging library and logging.config to help setup logging. Use the command below to easily setup logging for a project.
Usage
The default setup for logging adheres to the best practice guidelines described here.
import log_schema
import logging
log_schema.setup_logging()
logging.info("Hello")
# Output: {"timestamp": "2026-04-08T22:58:22.677137Z", "level": "INFO", "message": "Hello"}
The examples directory in this project contains additional examples on other features such as:
- Setup logging from a config (logging.config)
- Setup logging with dynamic fields
- Adding additional handlers with correct format
Implementation Notes
-
If using a custom config file, the fields in
modelwill overwrite the static_fields set in the config ONLY IF the formatters explicitly referencelog_schema.DefaultFormatterAND contains the same field key. -
Each handler has its own formatter. Any additional handlers added to the root logger needs to redefine the formatter. This can easily be done by using the
DefaultFormatterwith the samemodelused for setup. Alternatively, you can make new models for different handlers.new_handler.setFormatter(DefaultFormatter(models="<whatever model used for setup"))
Local Development
cd python
uv sync
uv run src/log_schema/main.py
Metadata
Release files for log-schema 0.2.10.dev1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| log_schema-0.2.10.dev1.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| log_schema-0.2.10.dev1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.5 kB
Release files / log_schema-0.2.10.dev1.tar.gz
| Download URL | log_schema-0.2.10.dev1.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68c4994c0f105d83c6018c11e71a4d092606b06d90d5ba71e28bd827054e7b4e
|
|
BLAKE2b-256 checksum How to use checksums |
b5e6d60ad510b2b57127fae677f5ce3d0beda8700418a64340c14653c97d5bcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / log_schema-0.2.10.dev1-py3-none-any.whl
| Download URL | log_schema-0.2.10.dev1-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52ea47aac71db15bab7bbccf3077425aade5c67795925ddc98b4901f26c56f11
|
|
BLAKE2b-256 checksum How to use checksums |
d85ed51bdec2f143dd1997565c2bb8163c7aa83f8d8ce84d50da55fbb5005b39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|