Example #1
0
 /**
  * Creates a new FirePHP logger.
  *
  * @param   string  config array
  * @return  void
  */
 public function __construct(array $config = NULL)
 {
     $this->_firephp = FirePHP_Profiler::instance();
     if (isset($config)) {
         $this->_firephp->set_config($config);
     }
     $this->_format = $this->_firephp->get_config('log.console.format', 'time --- type: body');
     $this->_excluded = $this->_firephp->get_config('log.console.exclude');
 }
Example #2
0
 public function before()
 {
     parent::before();
     $this->request->headers['Content-Type'] = 'text/plain';
     if ($lang = Kohana::config('torn')->default_controller_lang) {
         I18n::lang($lang);
     }
     if (class_exists('FirePHP_Profiler')) {
         FirePHP_Profiler::instance()->set_config('enabled', FALSE);
     }
 }
Example #3
0
 /**
  * Creates a new file logger.
  *
  * @param   string  log directory
  * @param   array   list of excluded types
  * @return  void
  */
 public function __construct($directory, array $config = NULL)
 {
     if (!is_dir($directory) or !is_writable($directory)) {
         throw new Kohana_Exception('Directory :dir must be writable', array(':dir' => Kohana::debug_path($directory)));
     }
     // Determine the directory path
     $this->_directory = realpath($directory) . DIRECTORY_SEPARATOR;
     $firephp = FirePHP_Profiler::instance();
     if (isset($config)) {
         $firephp->set_config($config);
     }
     $this->_format = $firephp->get_config('log.file.format', 'time --- type: body');
     $this->_excluded = $firephp->get_config('log.file.exclude');
 }
Kohana::$log->add('FirePHP::ERROR', 'FirePHP Error...');
$demo = array('label' => 'FirePHP Table...', 'table' => array(array('Col 1 Heading', 'Col 2 Heading'), array('Row 1 Col 1', 'Row 1 Col 2'), array('Row 2 Col 1', 'Row 2 Col 2'), array('Row 3 Col 1', 'Row 3 Col 2')));
Kohana::$log->add('FirePHP::LOG', array('label' => 'Passing objects to log...', 'object' => $demo));
Kohana::$log->add('FirePHP::TABLE', $demo);
Kohana::$log->add('FirePHP::LOG', 'FirePHP Log...');
// Not sure what dump does... ???
Kohana::$log->add('FirePHP::DUMP', array('key' => 2, 'variable' => $demo));
Kohana::$log->add('FirePHP::TRACE', 'FirePHP Trace...');
Kohana::$log->add('FirePHP::GROUP_END', '')->write();
// However, its much easier to just do this...
// All FirePHP commands are available, plus a few new ones...
Fire::log('Hi Mom!');
Fire::group('My Group')->warn('Warning!')->groupEnd();
Fire::error('UH OH! Now, look what you did it!');
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'welcome', 'action' => 'index'));
/**
 * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
 * If no source is specified, the URI will be automatically detected.
 */
echo Request::instance()->execute()->send_headers()->response;
/**
 * Run the at the end of the bootstap to profile the entire application
 * Alternatively, you can extend one of the FirePHP Controllers
 */
Fire::warn('Be sure to configure FirePHP authorization for productions sites. Don\'t want just anybody viewing this stuff...');
FirePHP_Profiler::instance()->group('KO3 FirePHP Profiler Results:')->superglobals()->database()->benchmark()->groupEnd();
Example #5
0
 public function after()
 {
     FirePHP_Profiler::instance()->group('KO3 FirePHP Profiler Results:')->superglobals()->database()->benchmark()->groupEnd();
     parent::after();
 }
Example #6
0
if (IN_PRODUCTION === TRUE) {
    try {
        // Attempt to execute the response
        $request->send_headers()->execute();
    } catch (Kohana_View_Exception $e) {
        // Create a 404 response
        $request->status = 404;
        $request->response = new View('public/template');
        $request->response->content = new View('public/404');
        $request->response->content->message = $e->getMessage();
    } catch (Exception $e) {
        // If there was an internal server error, we should record it for analysis
        Kohana::$log->add('500', $e . PHP_EOL . 'URI: ' . $request->uri);
        $request->status = 500;
        $request->response = new View('public/template');
        $request->response->content = new View('public/404');
        $request->response->content->message = 'error' . $e->getMessage();
    }
} else {
    // Attempt to execute the response
    try {
        $request->send_headers()->execute();
    } catch (Exception $e) {
        Kohana::$log->add('Exception', $e);
        throw $e;
    }
}
echo $request->response;
if (!Request::$is_ajax and !IN_PRODUCTION and class_exists('FirePHP_Profiler')) {
    FirePHP_Profiler::instance()->superglobals()->database()->benchmark();
}
Example #7
0
 public function query($type, $sql, $as_object)
 {
     $result = parent::query($type, $sql, $as_object);
     FirePHP_Profiler::instance()->query($result, $type, $sql);
     return $result;
 }
Example #8
0
 public static function multicolumn_table(array $data, $label = '', $count = TRUE, $row_num = TRUE)
 {
     return FirePHP_Profiler::instance()->multicolumn_table($data, $label, $count);
 }