Skip to main content

Typed, non-blocking JSON application logging setup (dictConfig + QueueHandler).

Project description

app-log-json

This is a public-source project — see CONTRIBUTING.md for the PR policy.

Typed, non-blocking JSON application logging setup: a JSONFormatter, a dictConfig-building helper, and a setup_logging() that wires a QueueHandler/QueueListener so logging never blocks the calling thread.

Library code must never call setup_logging() on import — only an application's entrypoint should call it.

Quickstart

uv add app-log-json
from app_log_json import build_config, get_logger, setup_logging

setup_logging(build_config("my_app"))
logger = get_logger("my_app")

logger.info("started", extra={"version": "1.2.3"})

Install

From a consuming project:

uv add --editable "../app-log-json"

Usage

from app_log_json import build_config, get_logger, setup_logging

setup_logging(build_config("my_app"))
logger = get_logger("my_app")

logger.info("started", extra={"version": "1.2.3"})
  • setup_logging(None) — stderr-only, no file handler, filesystem-safe.
  • setup_logging(build_config(...)) — stderr (text) + rotating JSON file.
  • setup_logging(Path("logging.json")) — load a JSON dictConfig file; a "()": "app_log_json.JSONFormatter" reference resolves because the library is importable.

Development

make test
make pre-commit-all

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

app_log_json-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

app_log_json-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file app_log_json-0.1.0.tar.gz.

File metadata

  • Download URL: app_log_json-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for app_log_json-0.1.0.tar.gz
Algorithm Hash digest
SHA256 606525978e89f2bb6eecbeb612bd006f869947410a348ece05da0f3a2900ac06
MD5 64fc802c6d0d44b6b4c3ff0a4b2172e4
BLAKE2b-256 e35f0f454ffd550e5026af81ab167cb83d6696c7e5de6050068f0560c8bb85f8

See more details on using hashes here.

File details

Details for the file app_log_json-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for app_log_json-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 133e3b93af8566f199267eff7640ab447a4a6a0e66d7829c8dfd921553130a67
MD5 868766f9af223c00f99f74bbfe7acda8
BLAKE2b-256 1b5e47cdd75d86fac0fd4d1529942ebdf8eebbb39edd47f40ee1c2361808bf86

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