当前位置: 首页>>代码示例>>PHP>>正文


PHP Console::getLogs方法代码示例

本文整理汇总了PHP中Console::getLogs方法的典型用法代码示例。如果您正苦于以下问题:PHP Console::getLogs方法的具体用法?PHP Console::getLogs怎么用?PHP Console::getLogs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Console的用法示例。


在下文中一共展示了Console::getLogs方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getConsoleMessages

 /**
  * @return array
  */
 protected function getConsoleMessages()
 {
     $messages = array();
     foreach ($this->console->getLogs() as $log) {
         switch ($log['type']) {
             case 'log':
                 $message = array('message' => print_r($log['data'], true), 'type' => 'log');
                 break;
             case 'memory':
                 $message = array('message' => (!empty($log['data_type']) ? "{$log['data_type']}: " : '') . $log['name'], 'data' => $this->getReadableMemory($log['data']), 'type' => 'memory');
                 break;
             case 'error':
                 $message = array('message' => "Line {$log['line']}: {$log['data']} in {$this->getFilePath($log['file'])}", 'type' => 'error');
                 break;
             case 'speed':
                 $elapsedTime = $log['data'] - $this->startTime;
                 $message = array('message' => $log['name'], 'data' => $this->getReadableTime($elapsedTime), 'type' => 'speed');
                 break;
             default:
                 $message = array('message' => "Unrecognized console log type: {$log['type']}", 'type' => 'error');
                 break;
         }
         array_push($messages, $message);
     }
     return $messages;
 }
开发者ID:jacobemerick,项目名称:pqp,代码行数:29,代码来源:Display.php

示例2: gatherConsoleData

 public function gatherConsoleData()
 {
     $logs = Console::getLogs();
     if ($logs['console']) {
         foreach ($logs['console'] as $key => $log) {
             if ($log['type'] == 'log') {
                 $logs['console'][$key]['data'] = print_r($log['data'], true);
             } elseif ($log['type'] == 'memory') {
                 $logs['console'][$key]['data'] = $this->getReadableFileSize($log['data']);
             } elseif ($log['type'] == 'speed') {
                 $logs['console'][$key]['data'] = $this->getReadableTime(($log['data'] - $this->startTime) * 1000);
             }
         }
     }
     $this->output['logs'] = $logs;
 }
开发者ID:SainsburysTests,项目名称:sainsburys,代码行数:16,代码来源:phpquickprofiler.php

示例3: __destruct

 public function __destruct()
 {
     $this->logs = Console::getLogs();
     $this->queries = Console::getQueries();
     // log the time the application took to execute
     $start_time = $this->startTime;
     $end_time = $this->endTime = microtime();
     $start_time_array = explode(' ', $start_time);
     $end_time_array = explode(' ', $end_time);
     $time = ($end_time_array[1] + $end_time_array[0] - ($start_time_array[1] + $start_time_array[0])) * 1000;
     // make time readable
     $ret = $time;
     $formatter = 0;
     $formats = array('ms', 's', 'm');
     if ($time >= 1000 && $time < 60000) {
         $formatter = 1;
         $ret = $time / 1000;
     }
     if ($time >= 60000) {
         $formatter = 2;
         $ret = $time / 1000 / 60;
     }
     $this->executionTime = $ret = number_format($ret, 3, '.', '') . ' ' . $formats[$formatter];
     if ($this->appOptions['PRINT_APP_INFO_ON_LOAD'] == true && !$this->isProduction() && !$this->isTesting()) {
         echo '<pre>';
         print_r($this);
         echo '</pre>';
     }
 }
开发者ID:Jsnrkd,项目名称:Walleye,代码行数:29,代码来源:walleye.php

示例4: view

 /**
  * Render a template through a basic php include
  *
  * ex. view('home/index.php', array('title'=>'Title'));
  *
  * @access protected
  * @param string $view the view to be rendered.
  * @param array $values the values to be shown on the view
  * @return void
  */
 protected function view($view, $values = array())
 {
     if (!Walleye::isProduction()) {
         $values['logs'] = Console::getLogs();
     } else {
         $values['logs'] = Console::getAlerts();
     }
     include Walleye::getServerBaseDir() . 'includes/app/views/' . $view;
 }
开发者ID:Jsnrkd,项目名称:Walleye,代码行数:19,代码来源:walleye.controller.php

示例5: __destruct

 /**
  * Print out the walleye object
  */
 public function __destruct()
 {
     if ($this->appOptions['PRINT_APP_INFO_ON_LOAD'] == true && $this->isProduction() == false && $this->isTesting() == false) {
         $this->logs = Console::getLogs();
         $this->queries = Console::getQueries();
         // log the time the application took to execute
         $start_time = $this->startTime;
         $end_time = $this->endTime = microtime();
         $start_time_array = explode(' ', $start_time);
         $end_time_array = explode(' ', $end_time);
         $time = ($end_time_array[1] + $end_time_array[0] - ($start_time_array[1] + $start_time_array[0])) * 1000;
         // make time readable
         $ret = $time;
         $formatter = 0;
         $formats = array('ms', 's', 'm');
         if ($time >= 1000 && $time < 60000) {
             $formatter = 1;
             $ret = $time / 1000;
         }
         if ($time >= 60000) {
             $formatter = 2;
             $ret = $time / 1000 / 60;
         }
         $this->executionTime = $ret = number_format($ret, 3, '.', '') . ' ' . $formats[$formatter];
         function convert($size)
         {
             $unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
             return @round($size / pow(1024, $i = floor(log($size, 1024))), 2) . ' ' . $unit[$i];
         }
         $this->peak_memory_usage = convert(memory_get_peak_usage(true));
         print_object($this);
     }
 }
开发者ID:Jmayhak,项目名称:Walleye,代码行数:36,代码来源:walleye.php

示例6: testAlertType

 /**
  *
  */
 public function testAlertType()
 {
     Console::Alert('hello', 'file.php', '111', false);
     $logs = Console::getLogs();
     $this->assertEquals('alert', $logs[0]['type']);
 }
开发者ID:Jmayhak,项目名称:Walleye,代码行数:9,代码来源:ConsoleTest.php

示例7: _compile_console

 public function _compile_console()
 {
     $logs = Console::getLogs();
     if ($logs['console']) {
         foreach ($logs['console'] as $key => $log) {
             if ($log['type'] == 'log') {
                 $logs['console'][$key]['data'] = print_r($log['data'], true);
             } elseif ($log['type'] == 'memory') {
                 $logs['console'][$key]['data'] = $this->get_file_size($log['data']);
             }
         }
     }
     return $logs;
 }
开发者ID:leloulight,项目名称:Sprint,代码行数:14,代码来源:Profiler.php


注:本文中的Console::getLogs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。