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