Skip to content

Commit

Permalink
Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
janvanicek committed Sep 7, 2020
1 parent fb0298b commit a0d8a62
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/NetteLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,15 @@ public function log($value, $priority = ILogger::INFO)
{
$response = parent::log($value, $priority);
$userId = null;
$url = null;

if ($this->identity) {
$userId = $this->identity->getId();
}

$url = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
if (isset($_SERVER['REQUEST_URI']) && isset($_SERVER['HTTP_HOST'])) {
$url = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
}

$logData = array(
'title' => null,
Expand Down Expand Up @@ -129,8 +132,6 @@ public function checkResponse($httpCode, $response)
switch ($httpCode):
case 401:
case 201:
$response = Json::decode($response)->status;
$this->logStatusToConsole($response);
break;
default:
$this->logStatusToConsole('Sending to API error, check API endpoint or url in config file!');
Expand Down

0 comments on commit a0d8a62

Please sign in to comment.