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


PHP Console::backtrace方法代码示例

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


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

示例1: exception

 function exception(Exception $e)
 {
     logger::emerg("Unhandled exception: (%s) %s in %s:%d", get_class($e), $e->getMessage(), str_replace(BASE_PATH, '', $e->getFile()), $e->getLine());
     Console::debugEx(0, get_class($e), "Unhandled exception: (%s) %s in %s:%d", get_class($e), $e->getMessage(), str_replace(BASE_PATH, '', $e->getFile()), $e->getLine());
     $f = file($e->getFile());
     foreach ($f as $i => $line) {
         $mark = $i + 1 == $e->getLine() ? '=> ' : '   ';
         $f[$i] = sprintf('  %05d. %s', $i + 1, $mark) . $f[$i];
         $f[$i] = str_replace("\n", "", $f[$i]);
     }
     $first = $e->getLine() - 4;
     if ($first < 0) {
         $first = 0;
     }
     $last = $e->getLine() + 3;
     if ($last >= count($f)) {
         $last = count($f) - 1;
     }
     $source = join("\n", array_slice($f, $first, $last - $first));
     Console::debugEx(0, get_class($e), Console::backtrace(0, $e->getTrace(), true));
     Console::debugEx(LOG_LOG, "Exception", "Source dump of %s:\n%s", str_replace(BASE_PATH, '', $e->getFile()), $source);
     $rv = 1;
     logger::emerg("Exiting with return code %d after exception.", $rv);
     Console::debugEx(LOG_BASIC, __CLASS__, "Exiting with return code %d after exception.", $rv);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:25,代码来源:exception.php

示例2: addField

 protected function addField($field, $meta)
 {
     // TODO: Verify the meta format
     $md = explode(' ', $meta);
     $mi = 0;
     $mo = array();
     // Console::debugEx(LOG_DEBUG2,__CLASS__,"Parsing quotes in array for %s", $meta);
     // Console::debugEx(LOG_DEBUG2,__CLASS__," \$md = {'%s'}", join("','", $md));
     while ($mi < count($md)) {
         // Console::debugEx(LOG_DEBUG2,__CLASS__,"Current token: %s", $md[$mi]);
         if ($md[$mi][0] == '"') {
             $buf = array();
             while ($mi < count($md)) {
                 $str = $md[$mi];
                 $buf[] = $md[$mi++];
                 // Console::debugEx(LOG_DEBUG2,__CLASS__," -- Quoted token: %s (%s)", $str, $str[strlen($str)-1]);
                 if ($str[strlen($str) - 2] == '"') {
                     break;
                 }
             }
             $bufstr = join(' ', $buf);
             $bufstr = substr($bufstr, 1, strlen($bufstr) - 2);
             $mo[] = $bufstr;
             Console::debugEx(LOG_DEBUG2, __CLASS__, "Joined quoted statement: %s", $bufstr);
         } else {
             $mo[] = $md[$mi++];
         }
     }
     $md = $mo;
     // Console::debugEx(LOG_DEBUG2,__CLASS__," \$md = {'%s'}", join("','", $md));
     $ftype = null;
     $fdef = null;
     $freq = false;
     $fprot = false;
     $mi = 0;
     while ($mi < count($md)) {
         // Console::debugEx(LOG_DEBUG1,__CLASS__,'Parsing abstract model field %s: %s', $field, $md[$mi]);
         switch (strtolower($md[$mi])) {
             case 'string':
                 $ftype = 'STRING';
                 break;
             case 'int':
                 $ftype = 'INT';
                 break;
             case 'bool':
                 $ftype = 'BOOL';
                 break;
             case 'set':
                 $ftype = 'SET';
                 break;
             case 'enum':
                 $ftype = 'STRING';
                 break;
             case 'required':
                 $freq = true;
                 break;
             case 'protected':
                 $fprot = true;
                 break;
             case 'index':
                 $this->_index = $field;
                 break;
             case 'default':
                 $fdef = $md[++$mi];
                 break;
             case 'like':
                 $flike = $md[++$mi];
                 break;
             case 'in':
             case 'of':
                 $fin = $md[++$mi];
                 break;
             case 'format':
                 if ($ftype == 'INT' || $ftype == 'STRING') {
                     // Check format
                 } else {
                     Console::warn('Format declaration for key %s ignored', $field);
                 }
                 break;
             case 'auto':
                 if ($ftype == 'INT') {
                 } else {
                     Console::warn('Only INT can be auto fields');
                 }
                 $fauto = true;
                 break;
         }
         $mi++;
     }
     if ($ftype != null) {
         $this->_fields[$field] = array('type' => $ftype, 'required' => $freq, 'default' => $fdef, 'protected' => $fprot);
         return true;
     } else {
         Console::warn('Bad type specified for field %s in AbstractModel implementation', $field);
         Console::backtrace();
     }
     return false;
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:98,代码来源:model.php


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