Skip to main content

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 at <log_dir>/<app_name>.log.jsonl.
  • setup_logging(Path("logging.json")) — load a JSON dictConfig file; a "()": "app_log_json.JSONFormatter" reference resolves because the library is importable.

Log location

build_config() picks the log directory in this order:

  1. The log_dir= argument, if given.
  2. The LOG_DIR environment variable, if set (~ is expanded).
  3. <project root>/.local/logs/, where the project root is the nearest ancestor of the current working directory containing pyproject.toml or .git (falling back to the CWD itself).

So an app run anywhere inside, say, ~/git/project logs to ~/git/project/.local/logs/ by default. Add .local/ to the app's .gitignore.

Development

make test
make pre-commit-all

Metadata

Release files for app-log-json 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for app-log-json 0.2.0
File Size Uploaded Provenance
app_log_json-0.2.0.tar.gz 7.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for app-log-json 0.2.0
File Interpreter ABI Platform
app_log_json-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.8 kB

Release files / app_log_json-0.2.0.tar.gz

Download URL app_log_json-0.2.0.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0bc2f0c0e587419d266331f81562c995e0c49a4da7df015c469cefc4a5e2da50
BLAKE2b-256 checksum
How to use checksums
f7238b1c586ca65e42575d3778e22e5860d639a2f8057acacd2a33dd0c37c95d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.12 {"installer":{"name":"uv","version":"0.12.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / app_log_json-0.2.0-py3-none-any.whl

Download URL app_log_json-0.2.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97edc4f1159250ee22c3b84a54f70a1dff6f6c59cff1310bea1f8acea32e8c82
BLAKE2b-256 checksum
How to use checksums
3c50072a134381c8e2b066da71b3880f2d6c5cb0d334fda5765004ef0be16edd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.12 {"installer":{"name":"uv","version":"0.12.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for app-log-json 0.2.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page