Closed
Description
The new HTTP logging middleware is a neat idea. IMO it's not really usable for anything else than simple console or file logging, though. This is because all of the information from the request and response is simply concatenated to a big string:
Request: Protocol: HTTP/2 Method: GET Scheme: https PathBase: Path: /serviceworker.js QueryString: Cache-Control: [Redacted] :authority: [Redacted] :method: [Redacted] :path: [Redacted] :scheme: [Redacted] Accept: */* Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9,da;q=0.8,da-DK;q=0.7 Cookie: [Redacted] Host: localhost:5001 Referer: [Redacted] User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36 service-worker: [Redacted] sec-fetch-site: [Redacted] sec-fetch-mode: [Redacted] sec-fetch-dest: [Redacted]
The string is fine, but including structured properties would make it possible to do lots of interesting things if working with a log storage implementation that supports structured properties. The above string could look like this structured:
Request: {Protocol} {Method} {Scheme} {PathBase} {Path} {QueryString} ...