Author: Raymond Bosman
Date: 2006-01-13 14:09:13 +0100 (Fri, 13 Jan 2006)
New Revision: 1826
Log:
#- Updated documentation
#- Moved the ezcDebugStructure
Added:
packages/Debug/trunk/src/structs/debug_structure.php
Removed:
packages/Debug/trunk/src/debug_structure.php
Modified:
packages/Debug/trunk/src/debug.php
packages/Debug/trunk/src/debug_autoload.php
packages/Debug/trunk/src/debug_message.php
packages/Debug/trunk/src/debug_timer.php
packages/Debug/trunk/src/formatters/html_formatter.php
packages/Debug/trunk/src/writers/memory_writer.php
packages/Debug/trunk/tests/debug_test.php
packages/Debug/trunk/tests/formatters/html_formatter_test.php
Modified: packages/Debug/trunk/src/debug.php
===================================================================
--- packages/Debug/trunk/src/debug.php 2006-01-13 13:05:52 UTC (rev 1825)
+++ packages/Debug/trunk/src/debug.php 2006-01-13 13:09:13 UTC (rev 1826)
@@ -107,21 +107,6 @@
private $writer = null;
/**
- * Debug level ERROR.
- */
- const ERROR = 1;
-
- /**
- * Debug level WARNING.
- */
- const WARNING = 2;
-
- /**
- * Debug level NOTICE.
- */
- const NOTICE = 3;
-
- /**
* Constructs a new debug object and attaches it to the log object.
*
* This method is private because the getInstance() should be called.
@@ -321,24 +306,6 @@
array( "source" => $lm->source, "category" => $lm->category,
"verbosity" => $lm->verbosity, "file" => $errfile, "line" => $errline )
);
}
-
-
- /**
- * Returns the type name of the verbosity $verbosity.
- *
- * @param int $severity
- * @return string
- */
- public static function getVerbosityName( $verbosity )
- {
- switch ( $verbosity )
- {
- case ezcDebug::NOTICE: return "Notice";
- case ezcDebug::WARNING: return "Warning";
- case ezcDebug::ERROR: return "Error";
- default: return "Unknown";
- }
- }
}
Modified: packages/Debug/trunk/src/debug_autoload.php
===================================================================
--- packages/Debug/trunk/src/debug_autoload.php 2006-01-13 13:05:52 UTC (rev
1825)
+++ packages/Debug/trunk/src/debug_autoload.php 2006-01-13 13:09:13 UTC (rev
1826)
@@ -11,7 +11,7 @@
return array(
'ezcDebug' => 'Debug/debug.php',
'ezcDebugMemoryWriter' => 'Debug/writers/memory_writer.php',
- 'ezcDebugStructure' => 'Debug/debug_structure.php',
+ 'ezcDebugStructure' => 'Debug/structs/debug_structure.php',
'ezcDebugTimer' => 'Debug/debug_timer.php',
'ezcDebugOutputFormatter' => 'Debug/interfaces/formatter.php',
Modified: packages/Debug/trunk/src/debug_message.php
===================================================================
--- packages/Debug/trunk/src/debug_message.php 2006-01-13 13:05:52 UTC (rev
1825)
+++ packages/Debug/trunk/src/debug_message.php 2006-01-13 13:09:13 UTC (rev
1826)
@@ -30,8 +30,9 @@
{
switch ( $name )
{
- case 'verbosity': $this->properties['verbosity'] = $value;
- break;
+ case 'verbosity':
+ $this->properties['verbosity'] = $value;
+ return;
}
return parent::__set( $name, $value );
Deleted: packages/Debug/trunk/src/debug_structure.php
===================================================================
--- packages/Debug/trunk/src/debug_structure.php 2006-01-13 13:05:52 UTC
(rev 1825)
+++ packages/Debug/trunk/src/debug_structure.php 2006-01-13 13:09:13 UTC
(rev 1826)
@@ -1,72 +0,0 @@
-<?php
-/**
- * File containing the ezcDebugStructure class.
- *
- * @package Debug
- * @version //autogentag//
- * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
- * @license http://ez.no/licenses/new_bsd New BSD License
- * @access private
- */
-
-/**
- * The ezcDebugStructure is used internally by the debug system to store
- * debug messages.
- *
- * @package Debug
- * @version //autogentag//
- * @access private
- */
-class ezcDebugStructure
-{
- /**
- * Holds the properties of this class.
- *
- * @var array(string=>mixed)
- */
- private $properties = array();
-
- /**
- * Sets the property $name to $value.
- *
- * @throws ezcBasePropertyNotFoundException if the property does not exist.
- * @param string $name
- * @param mixed $value
- * @return void
- */
- public function __set( $name, $value )
- {
- $this->properties[$name] = $value;
- }
-
- /**
- * Returns the property $name.
- *
- * @throws ezcBasePropertyNotFoundException if the property does not exist.
- * @param string $name
- * @return mixed
- */
- public function __get( $name )
- {
- return $this->properties[ $name ];
- }
-
- /**
- * Generates string output of the debug messages.
- *
- * The output generated is each value listed in the form "'key' =>
'value'".
- *
- * @return string
- */
- public function toString()
- {
- $str = "";
- foreach ( $properties as $key => $value )
- {
- $str .= "$key => $value\n";
- }
-
- return $str;
- }
-}
-?>
Modified: packages/Debug/trunk/src/debug_timer.php
===================================================================
--- packages/Debug/trunk/src/debug_timer.php 2006-01-13 13:05:52 UTC (rev
1825)
+++ packages/Debug/trunk/src/debug_timer.php 2006-01-13 13:09:13 UTC (rev
1826)
@@ -25,14 +25,14 @@
/**
* An internal structure which stores sources, groups, and timers.
*
- * @var array(string=>ezcDebugStructure)
+ * @var array(string=>ezcDebugTimerStruct)
*/
private $timers;
/**
* Similar to [EMAIL PROTECTED] $timers} but stores those that are
currently running.
*
- * @var array(string=>ezcDebugStructure)
+ * @var array(string=>ezcDebugTimerStruct)
*/
private $runningTimers;
@@ -197,7 +197,7 @@
/**
* Returns an array with the timer data.
*
- * @return array(ezcDebugStructure)
+ * @return array(ezcDebugTimerStruct)
*/
public function getTimeData()
{
Modified: packages/Debug/trunk/src/formatters/html_formatter.php
===================================================================
--- packages/Debug/trunk/src/formatters/html_formatter.php 2006-01-13
13:05:52 UTC (rev 1825)
+++ packages/Debug/trunk/src/formatters/html_formatter.php 2006-01-13
13:09:13 UTC (rev 1826)
@@ -12,11 +12,6 @@
* ezcDebugHtmlFormatter class implements a HTML debug formatter that outputs
* debug information nicely formated for inclusion on your web page.
*
- * Default color mapping:
- * - NOTICE - green
- * - WARNING - orange
- * - ERROR - red
- *
* @package Debug
* @version //autogentag//
*/
@@ -36,9 +31,6 @@
*/
public function __construct()
{
- $this->verbosityColors[ezcDebug::NOTICE] = 'green';
- $this->verbosityColors[ezcDebug::WARNING] = 'orange';
- $this->verbosityColors[ezcDebug::ERROR] = 'red';
}
/**
@@ -69,7 +61,6 @@
$str .= "<style type=\"text/css\">[EMAIL PROTECTED]
url(\"debug.css\");\n</style>\n\n";
$str .= "<table cellspacing='0'>\n";
-
$str .= $this->getLog( $writerData );
$str .= $this->getTimingsAccumulator( $timerData );
return $str;
@@ -88,10 +79,10 @@
{
$str .= "<tr>\n";
$str .= "\t<td class='debugheader' valign='top'>";
- $str .= "<b><font
color=\"{$this->verbosityColors[$w->verbosity]}\">";
- $str .= ezcDebug::getVerbosityName( $w->verbosity );
+ $str .= "<b><font color=\"".(isset(
$this->verbosityColors[$w->verbosity]) ? $this->verbosityColors[$w->verbosity]
: "" )."\">";
+ $str .= $w->verbosity;
$str .= ":</font>{$w->source}::{$w->category}</b></td>\n";
- $str .= "\t<td class='debugheader'
valign='top'>{$w->timedate}</td>\n";
+ $str .= "\t<td class='debugheader'
valign='top'>{$w->datetime}</td>\n";
$str .= "</tr>\n";
$str .= "<tr>\n";
$str .= "\t<td class='debugbody'
colspan='2'><pre>\n{$w->message}\n\t</pre></td>\n";
@@ -138,7 +129,6 @@
"<td class='timingpoint1' align='right'>" . sprintf(
'%.5f', ( $group->elapsedTime / $group->count ) ) .
"</td></tr>\n";
}
-
}
$str .= "</table>";
Copied: packages/Debug/trunk/src/structs/debug_structure.php (from rev 1737,
packages/Debug/trunk/src/debug_structure.php)
Modified: packages/Debug/trunk/src/writers/memory_writer.php
===================================================================
--- packages/Debug/trunk/src/writers/memory_writer.php 2006-01-13 13:05:52 UTC
(rev 1825)
+++ packages/Debug/trunk/src/writers/memory_writer.php 2006-01-13 13:09:13 UTC
(rev 1826)
@@ -38,7 +38,6 @@
$this->logData = array();
}
-
/**
* Writes a log entry to the internal memory structure.
*
Modified: packages/Debug/trunk/tests/debug_test.php
===================================================================
--- packages/Debug/trunk/tests/debug_test.php 2006-01-13 13:05:52 UTC (rev
1825)
+++ packages/Debug/trunk/tests/debug_test.php 2006-01-13 13:09:13 UTC (rev
1826)
@@ -104,17 +104,29 @@
$this->assertEquals("bla", $struct[0][1]->source );
}
- /*
+ /*
public function testTriggerError()
{
$dbg = $this->dbg;
trigger_error("[Aap, Noot] 2: Bernard, looking at all the quarters
that fell out of the vending machine he broke with the crowbar.");
$struct = $dbg->generateOutput();
+
var_dump ($struct);
}
*/
+/*
+ public function testTriggerError()
+ {
+ $debug = ezcDebug::getInstance();
+ $debug->setOutputFormatter( new ezcDebugHtmlFormatter() );
+ $debug->log("The system is going to reboot NOW.", 3 );
+ $out = $debug->generateOutput();
+ echo ($out);
+ }
+ */
+
public static function suite()
{
Modified: packages/Debug/trunk/tests/formatters/html_formatter_test.php
===================================================================
--- packages/Debug/trunk/tests/formatters/html_formatter_test.php
2006-01-13 13:05:52 UTC (rev 1825)
+++ packages/Debug/trunk/tests/formatters/html_formatter_test.php
2006-01-13 13:09:13 UTC (rev 1826)
@@ -39,7 +39,7 @@
$log1->source = "content";
$log1->category = "sql";
$log1->verbosity = 1;
- $log1->timedate = "Oct 05 2005 12:04:20";
+ $log1->datetime = "Oct 05 2005 12:04:20";
$log2 = new ezcDebugStructure();
$log2->message = "SELECT DISTINCT ezdiscountrule.id\n FROM
ezdiscountrule,\n ezuser_discountrule\n WHERE
ezuser_discountrule.contentobject_id = '10' AND\n".
@@ -47,7 +47,7 @@
$log2->source = "content";
$log2->category = "sql";
$log2->verbosity = 2;
- $log2->timedate = "Oct 05 2005 12:04:25";
+ $log2->datetime = "Oct 05 2005 12:04:25";
return array( $log1, $log2 );
}
@@ -58,7 +58,6 @@
$time = new ezcDebugTimer();
$time->startTimer("Script", "html_reporter_test", "script");
-
if ( true != false ) $i_do_something = false;
$time->startTimer("Timing module", "content", "module");
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components