Core Logger
implement log() function. more to squash Core Logger Class implement log() function
This commit is contained in:
parent
b53157370a
commit
49eff56e5d
46 changed files with 348 additions and 302 deletions
|
@ -9,6 +9,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Util\Network;
|
||||
|
||||
function geocoordinates_install()
|
||||
|
@ -54,25 +55,25 @@ function geocoordinates_resolve_item(&$item)
|
|||
$s = Network::fetchUrl("https://api.opencagedata.com/geocode/v1/json?q=".$coords[0].",".$coords[1]."&key=".$key."&language=".$language);
|
||||
|
||||
if (!$s) {
|
||||
logger("API could not be queried", LOGGER_DEBUG);
|
||||
Logger::log("API could not be queried", LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
$data = json_decode($s);
|
||||
|
||||
if ($data->status->code != "200") {
|
||||
logger("API returned error ".$data->status->code." ".$data->status->message, LOGGER_DEBUG);
|
||||
Logger::log("API returned error ".$data->status->code." ".$data->status->message, LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
if (($data->total_results == 0) || (count($data->results) == 0)) {
|
||||
logger("No results found for coordinates ".$item["coord"], LOGGER_DEBUG);
|
||||
Logger::log("No results found for coordinates ".$item["coord"], LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
$item["location"] = $data->results[0]->formatted;
|
||||
|
||||
logger("Got location for coordinates ".$coords[0]."-".$coords[1].": ".$item["location"], LOGGER_DEBUG);
|
||||
Logger::log("Got location for coordinates ".$coords[0]."-".$coords[1].": ".$item["location"], LOGGER_DEBUG);
|
||||
|
||||
if ($item["location"] != "")
|
||||
Cache::set("geocoordinates:".$language.":".$coords[0]."-".$coords[1], $item["location"]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue