Closed simonschaufi closed 4 years ago
Hi, Laravel not supported automatic setters.
You can create PR and insert Logger to ProviderAndDumperAggregator https://github.com/geocoder-php/GeocoderLaravel/blob/11408306ec9b148a7f465678488426f13dc26f25/src/ProviderAndDumperAggregator.php#L138 Here is example like can do this (I didn't testing this solution):
$this->aggregator->registerProvider($provider);
if (in_array('Psr\Log\LoggerAwareTrait', class_uses($provider) && app('Illuminate\Log\Logger') !== null) {
$provider->setLogger(app('Illuminate\Log\Logger'))
}
I hope this help you.
I tried debugging the whole process and this method got never called.
This is my config:
'providers' => [
Chain::class => [
GoogleMaps::class => [
env('GOOGLEMAPS_LOCALE', 'de-DE'),
env('GOOGLEMAPS_APIKEY_SERVER'),
],
Nominatim::class => [
'https://nominatim.openstreetmap.org',
'info@example.com',
],
],
],
and in my App I call:
$query = '<The address to be geocoded>';
$geoCoder = app('geocoder');
$addresses = $geoCoder->geocode($query)->get();
I would highly appreciate it if you could send me a working solution with the logger running.
General Information
GeocoderLaravel Version: any Laravel Version: 5.6 PHP Version: any Operating System and Version: any
Issue Description
I would like to log Exceptions during geocoding but don't know how to configure my logger. I already asked how to use the logger in Geocoder package and got an answer: https://github.com/geocoder-php/Geocoder/issues/901#issuecomment-440984616. What is missing is any kind of configuration to use the Laravel Logger
Steps to Replicate
$this->log()