logfmter
A Python package which supports global logfmt formatted logging.
Decision gist · record as of 2026-08-14
Yes. Logfmter is a lightweight, dependency-free formatter that solves a real problem—adopting structured logging without refactoring existing code. Active maintenance, permissive license, no known vulnerabilities, and low install friction make it a safe choice. Install if you need logfmt output from stdlib logging.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Low friction: pure Python wheel with no runtime dependencies.
- Actively maintained with recent releases; last commit 2026-06-05.
License · maintenance · safety
MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions.
last release 2026-03-11 (156 days) · last repo commit 2026-06-05 · 107 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 210,617 downloads/mo, #9,490 on PyPI
Alternatives
Verify before relying
import logging
from logfmter import Logfmter
handler = logging.StreamHandler()
handler.setFormatter(Logfmter())
logging.basicConfig(handlers=[handler])
logging.error("hello", extra={"alpha": 1})- Performance characteristics when formatting high-volume logs or large extra dictionaries.
- Compatibility with async logging frameworks or concurrent logging scenarios.
What it is and what it does
Logfmter is a Python logging formatter that converts stdlib logging output into logfmt structured format—a key-value log format designed for both human readability and machine parsing. It integrates as a standard logging.Formatter, so you pass it to a handler and all logs automatically emit as logfmt without touching any existing log statements. The formatter accepts configuration for which fields to include (like log level, timestamp, process name), custom key-to-LogRecord-attribute mappings, default values, and fields to exclude.
The package handles both simple log messages and extra dictionaries passed to logging calls, formatting them as space-separated key=value pairs. It supports subclassing for custom value formatting and can template default values using format strings. With no external dependencies and active maintenance, it's designed as a drop-in way to adopt structured logging in existing applications.
Use it for
- Adopt structured logging in an existing application without rewriting log statements.
- Ensure all third-party library logs conform to a single logfmt format for centralized log aggregation.
- Add trace IDs, request IDs, or other context fields to all logs via defaults without modifying each call.
- Parse logs programmatically or feed them to log aggregation tools that expect key-value structure.
- Customize log field names and values by subclassing to match your organization's logging schema.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Logfmter is a lightweight, dependency-free formatter that solves a real problem—adopting structured logging without refactoring existing code. Active maintenance, permissive license, no known vulnerabilities, and low install friction make it a safe choice. Install if you need logfmt output from stdlib logging.
Install
logfmter on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained with recent releases; last commit 2026-06-05.
Requires Python 3.10 or later.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions.
Quickstart
import logging
from logfmter import Logfmter
handler = logging.StreamHandler()
handler.setFormatter(Logfmter())
logging.basicConfig(handlers=[handler])
logging.error("hello", extra={"alpha": 1})
Verify before relying
- Performance characteristics when formatting high-volume logs or large extra dictionaries.
- Compatibility with async logging frameworks or concurrent logging scenarios.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 156 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 210,617 / month, #9,490 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: logfmter-0.0.12-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “logfmt structured logging”
- logfmterFormats Python stdlib logging output as logfmt structured logs…
- structlogstructlog is a structured logging library that lets you emit logs as…
- daiquiriDaiquiri simplifies Python logging configuration by providing a…
Give your agent the search over MCP, or paste the wish link into any chat.
More Monitoring packages
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
Provides generated Python code for OpenTelemetry semantic conventions, enabling standardized attribute naming and constant definitions for instrumentation and telemetry collection.
Install it if you are using OpenTelemetry and want to follow semantic conventions correctly.
Provides the reference implementation of the OpenTelemetry API for collecting and exporting traces, metrics, and logs from Python applications.
Provides the abstract API and interfaces for OpenTelemetry instrumentation in Python, defining how to emit traces, metrics, and logs without tying code to a specific SDK implementation.
Exports OpenTelemetry observability data to an OpenTelemetry Collector using Protobuf-encoded messages over HTTP.
Install it if you are using OpenTelemetry in Python and need to send data to a Collector over HTTP.
Provides automatic instrumentation commands and programmatic APIs to inject distributed tracing into Python applications without code changes, detecting and instrumenting packages used by your program.
Install it if you need distributed tracing without code changes and have compatible instrumented packages in your environment.
See also daiquiri · jsonformatter · logging-formatter-anticrlf · logging-json · structlog · python-json-logger · fluent-logger · mdc · colorlog · logstash_formatter