Skip to content

Commit

Permalink
Merge pull request #6 from aptoma/catch-subnet-ip-error
Browse files Browse the repository at this point in the history
Catch error when trying to retrieve client IP for logging purposes
  • Loading branch information
gunnarlium committed Feb 10, 2016
2 parents 88ee1f9 + c65d139 commit f6646c6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Aptoma/Log/RequestProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ public function __construct(Application $app, $token = null)

public function __invoke(array $record)
{
$record['extra']['clientIp'] = $this->getClientIp($this->app['request_stack']);
try {
$record['extra']['clientIp'] = $this->getClientIp($this->app['request_stack']);
} catch (\Exception $e) {
$record['extra']['clientIp'] = '';
}
if ($this->app->offsetExists('security')) {
$record['extra']['user'] = $this->getUsername($this->app['security']);
}
Expand Down

0 comments on commit f6646c6

Please sign in to comment.