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.1.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.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tidylog-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 32f7cdeea1a5b5fc6733ac812ab2195590298570e87694511eb7f3ab340e1f49
MD5 d11eac4cb96b549f7d84aef4845def9c
BLAKE2b-256 79a0fed03216e4bec997d993f602233bcb26da23b9328e822fbd94520dfa4c21

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tidylog-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dda71aa982e7952867754a1f4a26b88149d5106915de9a4df13f4f224bf03afb
MD5 072829aaa0ab3d5f4115adabb45366f7
BLAKE2b-256 fc223cd33e689aa8db8f90293a66fdc02bbe46a08f54afa60fc44f3673af7d0d

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