Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Enhance logger with structured req and res info (#42)
- Improved logger to capture detailed metadata for each request and response, including method, URL, transport, address, location, timezone, platform, and user agent. - Combined `city`, `region`, and `country` into a single `location` field for readability. - Ensured consistent handling of null values for improved structure and parsing. - Included error messages in logs for status codes >= 400 and response cookies. - Example Log: { "level": "info"/"error", "message": "[200] - [GET] http://localhost:55604/", "details": { "method": "GET", "url": "http://localhost:55604/", "transport": null, "address": null, "port": null, "addressType": null, "location": "Chicago, Illinois, US", "timezone": "America/Chicago", "reqCookies": ["access_token"], "platform": "macOS", "UA": "Mozilla/5.0 ... Chrome/130.0.0.0 Safari/537.36", "statusCode": 200, "responseTime": "1.00 ms", "resCookies": null } }
- Loading branch information