This release is a pre-release and may not be stable for production use.
SchLog: Schematized logging
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 schlog
import logging
schlog.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 referenceschlog.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/schlog/main.py
Metadata
Release files for schlog 0.2.10.dev0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| schlog-0.2.10.dev0.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| schlog-0.2.10.dev0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.4 kB
Release files / schlog-0.2.10.dev0.tar.gz
| Download URL | schlog-0.2.10.dev0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
260e05d6b15d6d690558c8a2561ea09392d5945247e2376e8436ced1fb0b09d9
|
|
BLAKE2b-256 checksum How to use checksums |
042bc3a8495e9175163d82f401a2172867e45c644be59c26d60a8290a336d95c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / schlog-0.2.10.dev0-py3-none-any.whl
| Download URL | schlog-0.2.10.dev0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e62ae42527ea0f7221642bbb9efd27e37475ce4a918db5d62e1c8ab8e5035722
|
|
BLAKE2b-256 checksum How to use checksums |
fdc41fd845dad070daf4f6415040ecf177147b92d5132127d34270ad6a49fd8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|