Skip to main content

loguru fast wrapping supports fastapi

Project description


FastLOG

FastLOG is a lightweight wrapper around Loguru that offers Prometheus metrics, automatic `trace_id`, colourful output, and a dead‑simple configuration API.

Package version Development Status Supported Python versions Ruff


✨ Features

  • Zero‑config out of the boxfrom fastlog-io import log; log.info("hello") works instantly.
  • Unified interfaceconfigure() + get_log(name) keep formatting consistent across modules.
  • Automatic trace_id – generates a 7‑char NanoID when none is bound, perfect for request tracing.
  • File rotation & retention – default rotation="100 MB"; tune it via configure().
  • Stdlib compatibility – built‑in reset_std_logging() redirects the logging module to fastlog-io.

🚀 Installation

pip install fastlog-io

Requirements


⚡ Quickstart

from fastlog import log, configure

# override defaults if needed
configure(level="DEBUG", log_dir="./logs")

log.info("service started")

# child logger
api_log = log.bind(name="api")
api_log.debug("new request")

Console output (colours stripped):

2025-06-21 09:57:56.510 | INFO     | app   | -cFZrY2V | main.<module>:7 | service started
2025-06-21 09:57:56.511 | DEBUG    | api   | -25bJVku | main.<module>:11 | new request

🔧 Environment variables

Variable Default Description
LOG_DIR (empty) Log file directory; leave blank to log to stderr only
LOG_LEVEL INFO Minimum log level
LOG_ROTATION 100 MB File rotation policy (Loguru syntax)

These can also be passed directly to configure() and override environment values.


🛠 Development & Tests (powered by uv)

# run tests in a temp venv with test extras installed
uv run --with '.[test]' pytest -q

# build wheel + sdist
uv build

# verify the built wheel in a clean env
uv run --with dist/*.whl --with pytest pytest -q

📄 License

MIT © 2025 OWQ

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

fastlog_io-0.1.7.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

fastlog_io-0.1.7-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file fastlog_io-0.1.7.tar.gz.

File metadata

  • Download URL: fastlog_io-0.1.7.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.29

File hashes

Hashes for fastlog_io-0.1.7.tar.gz
Algorithm Hash digest
SHA256 829eedeee3f04855a24b72c59d3c244110238d4b96eccd47fb1976d6940b3e9f
MD5 97d34f054ea4cb650fb965fdb6923d9c
BLAKE2b-256 999e4f905686575a8fd60bf7ef1615c4cf638b2a63e1ccf4216921174d6c3456

See more details on using hashes here.

File details

Details for the file fastlog_io-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for fastlog_io-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 c9e229f01f04e7204a111a7431fd2fdf535cdfc1bf5fd9c15b921032adf6f957
MD5 88a6916fdc12a8fad7b677d7849d97d9
BLAKE2b-256 39f6a1c9f105f709ea4e419c146566653a35fba93c8d846bc156e78a1a3159af

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