Skip to main content

Clean, colorized structured logging for Python with JSON extra fields

Project description

TidyLog

Clean, colorized structured logging for Python with JSON extra fields.

Installation

pip install tidylog

Usage

Console Logging

from tidylog import get_logger

logger = get_logger(__name__)
logger.info("User logged in", extra={"user_id": 123, "ip": "192.168.1.1"})

Output:

2024-01-15 10:30:00 - myapp - INFO - User logged in - {"user_id": 123, "ip": "192.168.1.1"}

File Logging

from tidylog import setup_file_logging

handler = setup_file_logging(
    "logs/app.log",
    level="DEBUG",
    logger_names=["myapp", "myapp.api"],
)

Examples

# Install in development mode
poetry install

# Run examples
poetry run python examples/console_logging.py
poetry run python examples/file_logging.py
poetry run python examples/custom_formatter.py

Build & Deploy

pip install build twine
python -m build
twine upload dist/*

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

tidylog-0.1.5.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

tidylog-0.1.5-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file tidylog-0.1.5.tar.gz.

File metadata

  • Download URL: tidylog-0.1.5.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for tidylog-0.1.5.tar.gz
Algorithm Hash digest
SHA256 22443245c026bb176aa354d55e982b281e5b19380e29161413c8af70741936dd
MD5 f71985d2551359216805dae27257b95b
BLAKE2b-256 ab6166780edb834137b70f93c2e662b2eb8127c61ddecb77cff2f0c339d0665f

See more details on using hashes here.

File details

Details for the file tidylog-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: tidylog-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for tidylog-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 28a915606e4ebb6865db0773158a93b77202aefbe8795da3a52d184b10823e56
MD5 569829abeee30f0040fc8d7a4eade72f
BLAKE2b-256 dde57dc58e497461d13f7773f82b9e9998c64f793772b68d73e61fd0ddaa6c87

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