Search code examples
ruby-on-railsrubygemsexternal

rails: How to log response & request of 3rd party gem?


My app using active_shipping gem that send XML requests to several APIs and receive from these APIs an XML responses.

I would like to log on my app every response/request and API url for this external gem.

What is the best way achieve this?


Solution

  • As it says in the active_shipping docs:

    To log requests and responses, just set the logger on your carrier class to some kind of Logger object:

    ActiveShipping::USPS.logger = Logger.new($stdout)