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.2.0.tar.gz (7.6 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.2.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tidylog-0.2.0.tar.gz
Algorithm Hash digest
SHA256 671c74ae5c1d3f81b94ebc910b313f31281905661150c4fb2dc5645b07bb52ab
MD5 dbc121df659fd9d158381add77cc234f
BLAKE2b-256 4d0929fd7057e382744937e7a186e36df3a43b794c2d8d8a77e218101a7f444d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tidylog-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa2edbea9622487ccebf3c578a3bad0480f3ce58355777ace57ddbfb244c67b0
MD5 de0904606b01ba1c178f1b44de4ea3df
BLAKE2b-256 72348f331c7c2a320a46ce7df0bde687e3f89418cbfd5469450feaf491149ef7

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