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

Uploaded Python 3

File details

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

File metadata

  • Download URL: tidylog-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 e62523f067b310f7f61e5de6e7dca02fae370de3b074ba8a037e2deb84a96399
MD5 f6159ba0507ac341614e6b3bb2a3b291
BLAKE2b-256 fc6748093af47e099bbfdaee8a936e413183c28f0b8235e4ea43a36d236b7794

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tidylog-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 02f72e7cf576506800167a9dbb61093a466752f5a98bd35b2d03a6c647cb5a9f
MD5 1b5ac3fde7c6aa91b80a5220ea1be931
BLAKE2b-256 681ec6ef1190d7a1e8aa43165462a5f439bea0cb05fa1044bc2ad4b0930ea2e0

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