Replace call for Logger with DI::logger() in nominatim addon

pull/1594/head
Art4 2025-01-24 11:46:58 +00:00
parent 9a91bae363
commit 9ceff8f592
1 changed files with 3 additions and 4 deletions

View File

@ -7,7 +7,6 @@
*/ */
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
@ -45,19 +44,19 @@ function nominatim_resolve_item(array &$item)
$s = DI::httpClient()->fetch('https://nominatim.openstreetmap.org/reverse?lat=' . $coords[0] . '&lon=' . $coords[1] . '&format=json&addressdetails=0&accept-language=' . $language); $s = DI::httpClient()->fetch('https://nominatim.openstreetmap.org/reverse?lat=' . $coords[0] . '&lon=' . $coords[1] . '&format=json&addressdetails=0&accept-language=' . $language);
if (empty($s)) { if (empty($s)) {
Logger::info('API could not be queried'); DI::logger()->info('API could not be queried');
return; return;
} }
$data = json_decode($s, true); $data = json_decode($s, true);
if (empty($data['display_name'])) { if (empty($data['display_name'])) {
Logger::info('No results found for coordinates', ['coordinates' => $item['coord'], 'data' => $data]); DI::logger()->info('No results found for coordinates', ['coordinates' => $item['coord'], 'data' => $data]);
return; return;
} }
$item['location'] = $data['display_name']; $item['location'] = $data['display_name'];
Logger::info('Got location', ['lat' => $coords[0], 'long' => $coords[1], 'location' => $item['location']]); DI::logger()->info('Got location', ['lat' => $coords[0], 'long' => $coords[1], 'location' => $item['location']]);
if (!empty($item['location'])) { if (!empty($item['location'])) {
DI::cache()->set('nominatim:' . $language . ':' . $coords[0] . '-' . $coords[1], $item['location']); DI::cache()->set('nominatim:' . $language . ':' . $coords[0] . '-' . $coords[1], $item['location']);