Skip to content

Remove unnecessary quoting #3

Open
@chdsbd

Description

@chdsbd
from logfmt import format


def test_logfmt_format():
    data = {
        "at": "info",
        "method": "GET",
        "path": "/",
        "host": "mutelight.org",
        "fwd": "124.133.52.161",
        "dyno": "web.2",
        "connect": "4ms",
        "service": "8ms",
        "status": 200,
        "bytes": 1653,
    }
    expected = 'at=info method=GET path=/ host=mutelight.org fwd="124.133.52.161" dyno=web.2 connect=4ms service=8ms status=200 bytes=1653'
    assert expected == ''.join(format(data))
    # actual = 'at="info" method="GET" path="/" host=mutelight.org fwd="124.133.52.161" dyno="web.2" connect="4ms" service="8ms" status=200 bytes=1653'

logfmt-python unnecessarily quotes values, which doesn't match the behavior of similar libraries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions