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.3.tar.gz (7.1 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.3-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tidylog-0.1.3.tar.gz
Algorithm Hash digest
SHA256 1b5bd5bbd7fe83c1867a634fae034aacc9ec4b0107d06889ae6a7faa57b4371b
MD5 c3410c5d08672f7728d2556dd797955b
BLAKE2b-256 792dd32fe91bb0c8905ce1bd5c50cd469ec19c03366d3250663723d8a92d2a0a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tidylog-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cdfffa7fe060f814211ee8acacceb6a9e68961b80d58d3a869e2545c2a02375e
MD5 b27dea4abcb97e61e713d5641595f49a
BLAKE2b-256 ffd9f9ce52b18faadb7d4a68d39527c4db3f2ea9b2f40d8f1c3ac33826cb49aa

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