Parse and generate log lines in the logfmt style.
Project description
Logfmt
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: https://github.com/kr/logfmt
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:
key1="value1" key2="value2"
Installation
To install it, simply:
pip install logfmt
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
logfmt-0.4.tar.gz
(3.4 kB
view details)
Built Distribution
File details
Details for the file logfmt-0.4.tar.gz
.
File metadata
- Download URL: logfmt-0.4.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.4.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9db2ba67519a968c5c3d2230e79ab68e6cfac791daa516bbca9e2606eb02a4c6 |
|
MD5 | f54e581be3bfed4b242a0ac383f649cb |
|
BLAKE2b-256 | 4640a3b1d774c8b919d9bcfbfe211c20f1b8f4d7478457c0cd831e8f4f17774c |
File details
Details for the file logfmt-0.4-py2.py3-none-any.whl
.
File metadata
- Download URL: logfmt-0.4-py2.py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.4.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0914b7ca93e75d841e6eb8a680fef4475a322f91be2c1883c0e9582e6620dc41 |
|
MD5 | dd72ff6335f06279c0ee660022c621d2 |
|
BLAKE2b-256 | f5fc143f15b9347c2e42a5c726a04defed086c543ddd541419c31baef01c6a17 |