Comcast / Comcast/RestfulHttpsProxy
[Feature] Logging/Logging API
- Dominant language
- Go
- Stars
- 14
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
## Problem
It would be useful to log http traffic and have a way to retrieve it (using a restful API)
## Feature Description
Implement a simple logging api that will return all logs, start recording traffic and stop recording. The API is partially documented in the `api-example-logs.md` file. The logic behind the API needs to be implemented as well.
## Additional Context
A partial implementation exists but is commented out, this is because it is not able to log request and response bodies. Since the bodies are Readers, once they are read the bytes are discarded. The body might be very large in some cases, such as a video download, so storing the whole thing in memory before writing to the file is not a good idea. A good way to do this would be to set up a TeeReader on the body and replace the body with the TeeReader. The TeeReader will be a passthrough that will also output to a buffer which will then be logged to a file. (Potential threading issues if buffer is not thread safe)
Contributor guide
Assessment
This issue has not been assessed yet.