Skip to content

Commit

Permalink
Enhanced debug logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lednerb committed May 8, 2019
1 parent c7e88b5 commit bdca9f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app/Jobs/NotifyCallbacksJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public function handle()
} else {
Log::warning('Scan results for Scan ID ' . $this->scan->id . ' could not be sent to: ' . $this->scan->callbackurls[0]);
}
} catch (\Exception $e) { }
} catch (\Exception $e) {
\Log::debug('The following Exception was thrown: ' . PHP_EOL . $e);
}
}

if ($hasAtLeastOneSuccessfulCallback) {
Expand Down
7 changes: 4 additions & 3 deletions app/Jobs/StartScannerJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ public function handle()
}

$client = $this->client ?: new HTTPClient();
$logInfo = PHP_EOL . 'Scan ID: ' . $this->scan->id . PHP_EOL . 'Scan URL: ' . $this->scan->url . PHP_EOL . 'Scanner: ' . $this->scannerCode . PHP_EOL . 'Scanner-URL: ' . $this->scannerUrl;

\Log::debug('Preparing ScanResult' . $logInfo);
$scanResult = $this->scan->results()->create([
'scanner_code' => $this->scannerCode
]);

$logInfo = PHP_EOL . 'Scan ID: ' . $this->scan->id . PHP_EOL . 'ScanResult ID: ' . $scanResult->id . PHP_EOL . 'Scan URL: ' . $this->scan->url . PHP_EOL . 'Scanner: ' . $this->scannerCode . PHP_EOL . 'Scanner-URL: ' . $this->scannerUrl;
\Log::debug('Sending scan start request' . $logInfo);
try {
$response = $client->request('POST', $this->scannerUrl, ['json' => [
Expand All @@ -70,6 +69,8 @@ public function handle()
'has_error' => true
]);
}
} catch (\Exception $e) { }
} catch (\Exception $e) {
\Log::debug('The following Exception was thrown: ' . PHP_EOL . $e);
}
}
}

0 comments on commit bdca9f9

Please sign in to comment.