HttpClientToCurlGenerator icon indicating copy to clipboard operation
HttpClientToCurlGenerator copied to clipboard

Integrate Automatic CURL Generation with Logging Frameworks

Open mozhganEtaati opened this issue 2 months ago • 1 comments

Currently, HttpClientToCurlGenerator allows generating CURL commands manually from HttpClient requests.

In many production scenarios, developers want to log HTTP requests automatically for debugging, monitoring, or auditing. Integrating CURL generation directly with popular logging frameworks would save time, reduce errors, and improve developer experience.

Proposed Feature

Send the generated CURL to the logging framework of your choice (.NET Logging, Serilog, NLog,...). Provide flexible configuration options, such as:

  • Which log level to use (Debug, Info, etc.)

HttpClient client = new HttpClient();
client.EnableCurlLogging(logger, httpRequestMessageInstance, config => {
     config.NeedAddDefaultHeaders = true;
     config.LogLevel = LogLevel.Debug;
});

mozhganEtaati avatar Oct 27 '25 19:10 mozhganEtaati

Amazing!!!!! It is beneficial and essential to debug and show the curl result in the log for all of the log manager packages.

amingolmahalle avatar Oct 28 '25 05:10 amingolmahalle