chao-peng / hertz

Go HTTP framework with high-performance and strong-extensibility for building micro-services.
https://www.cloudwego.io
Apache License 2.0
0 stars 0 forks source link

access log middleware: latency value is too long #1

Open chao-peng opened 3 days ago

chao-peng commented 3 days ago

Describe the bug

When using access log middleware and setup ${latency}, the output value contains too many white space!!!

To Reproduce

use the code below:

    h.Use(
        accesslog.New(
            accesslog.WithFormat(`[${time}] status=${status} latency="${latency}" method=${method} path=${path} queryParams=${queryParams}`),
        ),
    )

Expected behavior

we expect the output is latency="459ns". But we got latency=" 459ns".

Hertz version:

hertz: v0.9.3

Environment:

go version go1.23.1 linux/amd64

marscode-agent[bot] commented 3 days ago

Start working on this issue.