shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

debug.php (601B)


      1 <?php
      2 class ControllerEventDebug extends Controller {
      3 	public function before(&$route, &$args) {
      4 		if ($route == 'common/home') { // add the route you want to test
      5 			$this->session->data['debug'][$route] = microtime();		
      6 		}
      7 	}
      8 	
      9 	public function after($route, &$args, &$output) {
     10 		if ($route == 'common/home') { // add the route you want to test
     11 			if (isset($this->session->data['debug'][$route])) {
     12 				$log_data = array(
     13 					'route' => $route,
     14 					'time'  => microtime() - $this->session->data['debug'][$route]
     15 				);
     16 				
     17 				$this->log->write($log_data);
     18 			}
     19 		}
     20 	}	
     21 }