python-logfmter icon indicating copy to clipboard operation
python-logfmter copied to clipboard

Add Parser

Open td-anne opened this issue 5 months ago • 2 comments

I know logfmt is designed to be easy to parse. But there do seem to be some ambiguities about how things are supposed to be emitted and/or parsed (#14, #15, #16), and it's not clear that there is a canonical logfmt parsing library for Python. Presumably, many people who want to emit logfmt logs will also want to be able to parse them, whether for colourised display or for more sophisticated processing. I think it would be valuable for this package to also include a parser.

Another benefit of using a parser would be that the package's tests could be expanded to include round-trip testing. This could simply be manual examples, or if one were happy with the development dependency, one could use hypothesis to aggressively explore for problem cases.

Finally, a parser would serve as a concrete, implemented, definition of how logfmt should represent values. It could be adjusted to match other logfmt tools that people are likely to be working with, and then this package could be adjusted to ensure that it generated values that were correctly parsed.

td-anne avatar Jul 24 '25 11:07 td-anne

@td-anne I think this is a great call.

josheppinette avatar Jul 30 '25 01:07 josheppinette

I provided a parser in #51

spaceone avatar Sep 24 '25 10:09 spaceone