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

Uploaded Python 3

File details

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

File metadata

  • Download URL: tidylog-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 6fc831b42ded9efe19579e14cfacb508a7340db457092ba305c1ef6c33a2be0c
MD5 e8affebcb48da37b1d4276c2e7c7f494
BLAKE2b-256 eeac5ebf37d9859a5ac7e9c7f94d8a04991c2c3f9a176cfc99dfd7007434fd8a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tidylog-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fd212cc03a18a71f032e757b636ab009783d15012ba66d9983fdcc05265ff4d4
MD5 2428d41378e36a48431524e8ecce8c2f
BLAKE2b-256 98beb13aaa334e44159b054b9889ddf0f8fa80a9a0ca9841bdbd98033eaf14c2

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