Adds logfmt structured logging to Python's standard logging module without requiring changes to existing log calls.
Logfmter is a Python library that adds logfmt structured logging to the standard library's logging module. It solves the problem of inconsistent or unstructured logs by formatting all log output into key=value pairs, making logs both human-readable and machine-parsable without requiring changes to existing logging code.
Python developers and DevOps engineers who need structured logging for better log aggregation, analysis, and monitoring in their applications, especially those already using Python's built-in logging module.
Developers choose Logfmter because it provides structured logging with zero code changes, works seamlessly with any library using Python's logging module, and offers greater flexibility and simplicity compared to alternatives like structlog that may require rewriting log statements.
Add logfmt structured logging using the stdlib logging module and without changing a single log call.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works with existing logging.warn() and logging.error() calls without modifications, enabling drop-in structured logging as shown in the basicConfig example.
Formats logs from all libraries using Python's logging module, ensuring consistent logfmt output across first and third-party code without format inconsistencies.
Offers parameters like keys, mapping, datefmt, defaults, and ignored_keys for customizing log output, demonstrated in the Configuration section with trace IDs and aliases.
Allows subclassing to override behavior, such as custom value formatting for booleans, as shown in the Extension example with a CustomLogfmter class.
Explicitly unsupported in the README, which can hinder integration in projects using file-based logging configurations without workarounds.
Limited to logfmt key-value pairs, lacking built-in support for other structured formats like JSON, which might be preferred for systems requiring nested data.
Requires passing extras via the msg argument instead of the extra parameter for internal attributes, adding complexity and potential for errors in log calls.