alexpechkarev / google-maps

Collection of Google Maps API Web Services for Laravel
https://alexpechkarev.github.io/google-maps/
MIT License
523 stars 115 forks source link

Add api (curl) request logging, behind APP_DEBUG=true or similar config options #115

Open emjayess opened 4 months ago

emjayess commented 4 months ago

I've been using this just a few weeks, and have a need for greater visibility / observability into the raw Api requests that are being initiated against the api.

So, for instance, propose a need for curl logging the request and perhaps enable conditionally based on APP_DEBUG, or a similar flag in config/googlemaps.php.

lrljoe commented 4 months ago

What specifically are you looking to log?

For example - I pass in an array of "Locations" to the frontend, which are then rendered as "Markers" on a Google Maps instance. I only care about that array, not what the API request ultimately returns.

Be aware that ultimately, most of the Google Maps stuff is happening in the frontend. The backend doesn't necessarily know about the user scrolling around the map (unless you hook into the scroll events from the Google Maps library).

emjayess commented 4 months ago

Ah, I am primarily utilizing the distancematrix and geocoding, maybe soon also directions – and distancematrix in my use cases is almost always a single origin and single destination. At least at this point have not been presenting maps.. thus far, I'm just sprinkling the distance and duration text results out to the UI.

Out of the gate I have been seeing some like ZERO_RESULTS, NOT_FOUND, or just obviously unexpected distances and durations... seeming to indicate a mangled address or improperly sanitized/supplied-by-my-code addresses..

What specifically are you looking to log?

For the generated Api requests & responses, and when I am desiring better visibility into what's going on, I guess I'd like to capture as much instrumentation as possible. I have even considered creating a table (and a migration and model, in Laravel) around these, toward the ends of being able to track improvements in results and cleaning up this data and implementation over time.