Skip to main content

General purpose logging utility library

Project description

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 model will overwrite the static_fields set in the config ONLY IF the formatters explicitly reference schlog.DefaultFormatter AND 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 DefaultFormatter with the same model used 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

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

schlog-0.2.10.dev0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

schlog-0.2.10.dev0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file schlog-0.2.10.dev0.tar.gz.

File metadata

  • Download URL: schlog-0.2.10.dev0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for schlog-0.2.10.dev0.tar.gz
Algorithm Hash digest
SHA256 260e05d6b15d6d690558c8a2561ea09392d5945247e2376e8436ced1fb0b09d9
MD5 daa51c94e7aab62c97d72a7d12145547
BLAKE2b-256 042bc3a8495e9175163d82f401a2172867e45c644be59c26d60a8290a336d95c

See more details on using hashes here.

File details

Details for the file schlog-0.2.10.dev0-py3-none-any.whl.

File metadata

  • Download URL: schlog-0.2.10.dev0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for schlog-0.2.10.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 e62ae42527ea0f7221642bbb9efd27e37475ce4a918db5d62e1c8ab8e5035722
MD5 e502389ddff7035f5f96c4ffed96674c
BLAKE2b-256 fdc41fd845dad070daf4f6415040ecf177147b92d5132127d34270ad6a49fd8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page