httptoolkit / mockttp

Powerful friendly HTTP mock server & proxy library
https://httptoolkit.com
Apache License 2.0
786 stars 88 forks source link

Only log socket errors if debug is enabled #167

Closed lipsumar closed 7 months ago

lipsumar commented 7 months ago

Similar to https://github.com/httptoolkit/mockttp/issues/148, I'm finding the logging of socket errors to be too noisy. Even with the proxy setup to only intercept a specific domain (via tlsInterceptOnly), errors such as ECONNRESET or EPIPE happen frequently on other requests.

Following a similar approach as suggested in https://github.com/httptoolkit/mockttp/issues/148, this PR puts the console.log in the socket error listener behind options.debug. These errors being somewhat expected (comment says: Clients may disconnect at this point (for all sorts of reasons)), it seems reasonable to require the debug option to be set for them to be logged.

pimterry commented 7 months ago

Makes sense! :+1: merged.

pimterry commented 7 months ago

I don't think I mentioned by the way: HTTP Toolkit Pro is totally free for all contributors to the HTTP Toolkit repos.

Is that something you'd be interested in? Let me know if so, and whether you'd prefer to use the datacamp email from your commits or the gmail email on your GH profile, and I'll set up an account.

lipsumar commented 7 months ago

That's very generous of you, yes I'm interested! Please use my personal email on my profile. Thanks!

pimterry commented 7 months ago

Done! :+1: