algoliasearch-client-csharp icon indicating copy to clipboard operation
algoliasearch-client-csharp copied to clipboard

Need a way to add custom logging for the Http Request and Response

Open MingLu8 opened this issue 4 years ago • 1 comments

It could be critical to log the http requests and responses from the http requests. Current, there is hard code LogHelper.LogToFile(request.Body) in the AlgoliaHttpRequester.cs class's SendRequestAsync method and this classs is internal.

There isn't an easy way to inject in a custom logger.

MingLu8 avatar Jan 27 '21 19:01 MingLu8

Hello,

There isn't an easy way to inject in a custom logger.

That's true - it's something we could look at. cc @TomKlotzPro

Current, there is hard code LogHelper.LogToFile(request.Body) in the AlgoliaHttpRequester.cs class's SendRequestAsync

You can enable this logger by setting the ALGOLIA_DEBUG env variable if you need it for debugging purposes.

Ant-hem avatar Jan 27 '21 19:01 Ant-hem

Hello,

A new version of the client (Alpha) is now released on Nuget. You can now inject a LoggerFactory. If you want the response you have to be in Trace log level.

If you have time, we need customer feedback about this new version. It's still not GA so you may not want to use it in production.

There is no more deps on Newtonsoft, all Algolia APIs are now available (Insights, Recommend, Query Perso, ...) and all models and routes are synced.

To help you migrate, there is a Migration guide.

Happy to help in your migration process !

morganleroi avatar Feb 21 '24 10:02 morganleroi