Skip to main content

Beautiful, structured console logging

Project description

logfmt 📝

Beautiful, structured console logging for Python.

Installation

pip install logfmt

Usage

from logfmt import Logger

log = Logger("myapp")

log.debug("Debugging info", variable=42)
log.info("Server started", port=8080, host="0.0.0.0")
log.warning("High memory usage", percent=85)
log.error("Connection failed", host="db.example.com", retry=3)
log.critical("System shutdown imminent")

Output

2025-12-18 10:30:45 INFO  [myapp] Server started port=8080 host=0.0.0.0
2025-12-18 10:30:46 WARN  [myapp] High memory usage percent=85
2025-12-18 10:30:47 ERROR [myapp] Connection failed host=db.example.com retry=3

Features

  • 🎨 Colored output (auto-detected)
  • 📊 Structured key-value logging
  • ⏰ Timestamps
  • 🎚️ Log levels
  • 📤 Configurable output stream

Configuration

from logfmt import Logger, LogLevel

log = Logger(
    name="myapp",
    level=LogLevel.DEBUG,  # Minimum log level
    colorize=True,         # Enable colors
    timestamp=True,        # Show timestamps
)

Log Levels

Level Value Use Case
DEBUG 10 Detailed debugging
INFO 20 General information
WARNING 30 Warning messages
ERROR 40 Error conditions
CRITICAL 50 Critical failures

License

MIT

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

pylogfmt_rj-1.0.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylogfmt_rj-1.0.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file pylogfmt_rj-1.0.0.tar.gz.

File metadata

  • Download URL: pylogfmt_rj-1.0.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for pylogfmt_rj-1.0.0.tar.gz
Algorithm Hash digest
SHA256 eef65cc33de62a396d082aa92d4ebd1a622ce1fa1accf93309fbd9014466a25d
MD5 a474b13f921bcea01a7589b6a98770b5
BLAKE2b-256 4a39100ca093a8bbada473250dfab82bd42d0e0379f7c9951b57350b047aaa51

See more details on using hashes here.

File details

Details for the file pylogfmt_rj-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pylogfmt_rj-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for pylogfmt_rj-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea6457551ff6f52dbb1a370e0336c6d236be2cdd8046826fd2dab3042a4f02fc
MD5 374639f946057842c25fd337fc04bcd4
BLAKE2b-256 89db8e6a289c9e851902dda5be6f312c9f332eaf4dd55517dafdf5feb97252a1

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