Better logger usage.

This commit is contained in:
Alexey Skobkin 2015-06-02 05:05:03 +03:00
parent 24d2ae468a
commit a9f53f3b25

View file

@ -69,10 +69,7 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand
} catch (\Exception $e) {
// @todo fallback to the local subscribers list
$output->writeln('Error while getting service subscribers');
$log->error('Error while getting service subscribers.' . PHP_EOL .
$e->getMessage() . PHP_EOL .
$e->getFile() . ':' . $e->getLine()
);
$log->error('Error while getting service subscribers.', ['message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]);
return false;
}
@ -85,10 +82,7 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand
try {
$subscriptionsManager->updateUserSubscribers($serviceUser, $serviceSubscribers);
} catch (\Exception $e) {
$log->error('Error while updating service subscribers' . PHP_EOL .
$e->getMessage() . PHP_EOL .
$e->getFile() . ':' . $e->getLine()
);
$log->error('Error while updating service subscribers', ['message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]);
return false;
}
@ -106,10 +100,7 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand
$userCurrentSubscribers = $api->getUserSubscribersById($user->getId());
} catch (\Exception $e) {
$output->writeln(' Error while getting subscribers. Skipping.');
$log->error('Error while getting subscribers.' . PHP_EOL .
$e->getMessage() . PHP_EOL .
$e->getFile() . ':' . $e->getLine()
);
$log->error('Error while getting subscribers.', ['message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]);
continue;
}
@ -122,10 +113,7 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand
// Updating user subscribers
$subscriptionsManager->updateUserSubscribers($user, $userCurrentSubscribers);
} catch (\Exception $e) {
$log->error('Error while updating user subscribers' . PHP_EOL .
$e->getMessage() . PHP_EOL .
$e->getFile() . ':' . $e->getLine()
);
$log->error('Error while updating user subscribers', ['message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]);
}
// @todo move to the config