public function listenToEvents()
{
$this->timeline->startEvent('total', 'Total execution time.', 'start');
$this->app['events']->listen('clockwork.controller.start', function () {
$this->timeline->startEvent('controller', 'Controller running.');
});
$this->app['events']->listen('clockwork.controller.end', function () {
$this->timeline->endEvent('controller');
});
$this->app['events']->listen('illuminate.log', function ($level, $message, $context) {
$this->log->log($level, $message, $context);
});
$this->app['events']->listen('composing:*', function ($view) {
$time = microtime(true);
$this->views->addEvent('view ' . $view->getName(), 'Rendering a view', $time, $time, array('name' => $view->getName(), 'data' => $this->replaceUnserializable($view->getData())));
});
}