[limb-svn] r6982 - in 3.x/trunk/limb: core/src dbal/src/drivers log/src
svn at limb-project.com
svn at limb-project.com
Sun May 4 16:13:18 MSD 2008
Author: pachanga
Date: 2008-05-04 16:13:18 +0400 (Sun, 04 May 2008)
New Revision: 6982
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6982
Added:
3.x/trunk/limb/core/src/lmbBacktrace.class.php
Removed:
3.x/trunk/limb/log/src/lmbBacktrace.class.php
Modified:
3.x/trunk/limb/dbal/src/drivers/lmbAuditDbConnection.class.php
3.x/trunk/limb/log/src/lmbLog.class.php
Log:
-- moving lmbBactrace to core
Copied: 3.x/trunk/limb/core/src/lmbBacktrace.class.php (from rev 6981, 3.x/trunk/limb/log/src/lmbBacktrace.class.php)
===================================================================
--- 3.x/trunk/limb/core/src/lmbBacktrace.class.php (rev 0)
+++ 3.x/trunk/limb/core/src/lmbBacktrace.class.php 2008-05-04 12:13:18 UTC (rev 6982)
@@ -0,0 +1,125 @@
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+
+/**
+ * class lmbBacktrace.
+ *
+ * @package log
+ * @version $Id$
+ */
+class lmbBacktrace
+{
+ protected $backtrace = array();
+
+ function __construct($limit_or_backtrace = null, $limit_or_offset = null, $offset = 0)
+ {
+ if(is_array($limit_or_backtrace))
+ {
+ $this->backtrace = $limit_or_backtrace;
+ $limit = $limit_or_offset;
+ }
+ else
+ {
+ $this->backtrace = debug_backtrace();
+ $limit = $limit_or_backtrace;
+ $offset = (int)$limit_or_offset;
+ }
+
+ //we skip this function call also
+ for($i=0; $i<($offset+1); $i++)
+ array_shift($this->backtrace);
+
+ if(!is_null($limit))
+ $this->backtrace = array_splice($this->backtrace, 0, $limit);
+ }
+
+ function get()
+ {
+ return $this->backtrace;
+ }
+
+ function getContext()
+ {
+ reurn (sizeof($this->backtrace)) ? $this->backtrace[0] : '';
+ }
+
+ function toString()
+ {
+ $trace_string = '';
+
+ foreach($this->backtrace as $item)
+ {
+ $trace_string .= '* ';
+ $trace_string .= $this->_formatBacktraceItem($item) . "\n";
+ }
+ return $trace_string;
+ }
+
+ function _formatBacktraceItem($item)
+ {
+ $trace_string = '';
+
+ if(isset($item['class']))
+ {
+ $trace_string .= $item['class'];
+ $trace_string .= "::";
+ }
+
+ if(isset($item['function']))
+ {
+ $trace_string .= $item['function'];
+ $trace_string .= "(";
+ }
+
+ if(isset($item['args']))
+ {
+ $sep = '';
+ foreach($item['args'] as $arg)
+ {
+ $trace_string .= $sep;
+ $sep = ', ';
+
+ if(is_null($arg))
+ $trace_string .= 'NULL';
+ elseif(is_array($arg))
+ $trace_string .= 'ARRAY[' . sizeof($arg) . ']';
+ elseif(is_object($arg))
+ $trace_string .= 'OBJECT:' . get_class($arg);
+ elseif(is_bool($arg))
+ $trace_string .= $arg ? 'TRUE' : 'FALSE';
+ else
+ {
+ $trace_string .= '"';
+ $trace_string .= htmlspecialchars(substr((string) @$arg, 0, 100));
+
+ if(strlen($arg) > 100)
+ $trace_string .= '...';
+
+ $trace_string .= '"';
+ }
+ }
+ }
+
+ if(isset($item['function']))
+ {
+ $trace_string .= ")";
+ }
+
+ if(isset($item['file']))
+ {
+ $trace_string .= ' in "' . $item['file'] . '"';
+ $trace_string .= " line ";
+ $trace_string .= $item['line'];
+ }
+
+ return $trace_string;
+ }
+}
+
+
Modified: 3.x/trunk/limb/dbal/src/drivers/lmbAuditDbConnection.class.php
===================================================================
--- 3.x/trunk/limb/dbal/src/drivers/lmbAuditDbConnection.class.php 2008-05-04 09:04:00 UTC (rev 6981)
+++ 3.x/trunk/limb/dbal/src/drivers/lmbAuditDbConnection.class.php 2008-05-04 12:13:18 UTC (rev 6982)
@@ -7,12 +7,11 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
lmb_require('limb/dbal/src/drivers/lmbDbConnection.interface.php');
+lmb_require('limb/core/src/lmbBacktrace.class.php');
lmb_require('limb/core/src/lmbDecorator.class.php');
lmbDecorator :: generate(get_class(lmbToolkit::instance()->getDefaultDbConnection()), 'lmbDbConnectionDecorator');
-lmb_require('limb/log/src/lmbBacktrace.class.php');
-
/**
* class lmbAuditDbConnection.
* Remembers stats for later analysis, especially useful in tests
Deleted: 3.x/trunk/limb/log/src/lmbBacktrace.class.php
===================================================================
--- 3.x/trunk/limb/log/src/lmbBacktrace.class.php 2008-05-04 09:04:00 UTC (rev 6981)
+++ 3.x/trunk/limb/log/src/lmbBacktrace.class.php 2008-05-04 12:13:18 UTC (rev 6982)
@@ -1,125 +0,0 @@
-<?php
-/*
- * Limb PHP Framework
- *
- * @link http://limb-project.com
- * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
- * @license LGPL http://www.gnu.org/copyleft/lesser.html
- */
-
-/**
- * class lmbBacktrace.
- *
- * @package log
- * @version $Id$
- */
-class lmbBacktrace
-{
- protected $backtrace = array();
-
- function __construct($limit_or_backtrace = null, $limit_or_offset = null, $offset = 0)
- {
- if(is_array($limit_or_backtrace))
- {
- $this->backtrace = $limit_or_backtrace;
- $limit = $limit_or_offset;
- }
- else
- {
- $this->backtrace = debug_backtrace();
- $limit = $limit_or_backtrace;
- $offset = (int)$limit_or_offset;
- }
-
- //we skip this function call also
- for($i=0; $i<($offset+1); $i++)
- array_shift($this->backtrace);
-
- if(!is_null($limit))
- $this->backtrace = array_splice($this->backtrace, 0, $limit);
- }
-
- function get()
- {
- return $this->backtrace;
- }
-
- function getContext()
- {
- reurn (sizeof($this->backtrace)) ? $this->backtrace[0] : '';
- }
-
- function toString()
- {
- $trace_string = '';
-
- foreach($this->backtrace as $item)
- {
- $trace_string .= '* ';
- $trace_string .= $this->_formatBacktraceItem($item) . "\n";
- }
- return $trace_string;
- }
-
- function _formatBacktraceItem($item)
- {
- $trace_string = '';
-
- if(isset($item['class']))
- {
- $trace_string .= $item['class'];
- $trace_string .= "::";
- }
-
- if(isset($item['function']))
- {
- $trace_string .= $item['function'];
- $trace_string .= "(";
- }
-
- if(isset($item['args']))
- {
- $sep = '';
- foreach($item['args'] as $arg)
- {
- $trace_string .= $sep;
- $sep = ', ';
-
- if(is_null($arg))
- $trace_string .= 'NULL';
- elseif(is_array($arg))
- $trace_string .= 'ARRAY[' . sizeof($arg) . ']';
- elseif(is_object($arg))
- $trace_string .= 'OBJECT:' . get_class($arg);
- elseif(is_bool($arg))
- $trace_string .= $arg ? 'TRUE' : 'FALSE';
- else
- {
- $trace_string .= '"';
- $trace_string .= htmlspecialchars(substr((string) @$arg, 0, 100));
-
- if(strlen($arg) > 100)
- $trace_string .= '...';
-
- $trace_string .= '"';
- }
- }
- }
-
- if(isset($item['function']))
- {
- $trace_string .= ")";
- }
-
- if(isset($item['file']))
- {
- $trace_string .= ' in "' . $item['file'] . '"';
- $trace_string .= " line ";
- $trace_string .= $item['line'];
- }
-
- return $trace_string;
- }
-}
-
-
Modified: 3.x/trunk/limb/log/src/lmbLog.class.php
===================================================================
--- 3.x/trunk/limb/log/src/lmbLog.class.php 2008-05-04 09:04:00 UTC (rev 6981)
+++ 3.x/trunk/limb/log/src/lmbLog.class.php 2008-05-04 12:13:18 UTC (rev 6982)
@@ -7,7 +7,7 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
lmb_require('limb/log/src/lmbLogEntry.class.php');
-lmb_require('limb/log/src/lmbBacktrace.class.php');
+lmb_require('limb/core/src/lmbBacktrace.class.php');
/**
* class lmbLog.
More information about the limb-svn
mailing list