/** * Overwrite the error_handler. When in development output errors, throw exceptions in production. * * @access public * @param int $number * @param string $message * @param string $file * @param int $line * @param string $context * @return void * @static */ public static function error($number, $message, $file = null, $line = null, $context = null) { static::$__errors[] = compact($number, $message, $file, $line); if (Config::get('debug') > 0) { static::__output($number, $message, $file, $line, $context); } else { Logger::write(sprintf('[%s] %s: %s in %s on line %s.', date('d-M-Y H:i:s'), static::errorType($number), $message, $file, $line)); } return true; }
/** * Stop the benchmarking process by logging the micro seconds and memory usage and then outputting the results. * * @access public * @param string $slug * @param boolean $log * @return string|mixed * @static */ public static function stop($slug = 'benchmark', $log = self::DONT_LOG) { if (Config::get('debug') > 0) { if (empty(static::$__benchmarks[$slug])) { return false; } static::$__benchmarks[$slug] = array('endTime' => microtime(true), 'endMemory' => memory_get_usage()) + static::$__benchmarks[$slug]; if ($log === static::DO_LOG) { Logger::debug(static::display($slug)); } return static::$__benchmarks[$slug]; } }