Skip to main content

Parse and generate log lines in the logfmt style.

Project description


Python package for parsing log lines in the logfmt style. See the original project by Blake Mizerany and Keith Rarick for information about logfmt conventions and use:

Using logfmt

Easily process lines from logfmt formatted input:

from logfmt import parse

input = StringIO('\n'.join(['key1=value1', 'key2=value2']))
for values in parse(input):
    print values

This program produces this output:

{'key1': 'value1'}
{'key2': 'value2'}

Easily generate lines in logfmt formatted output

from logfmt import format

for line in format({'key1': 'value1'}, {'key2': 'value2'}):
    print line

This program produces this output:



To install it, simply:

pip install logfmt

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for logfmt, version 0.4
Filename, size File type Python version Upload date Hashes
Filename, size logfmt-0.4-py2.py3-none-any.whl (3.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size logfmt-0.4.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page