summaryrefslogtreecommitdiff
path: root/framework/Log
diff options
context:
space:
mode:
authorxue <>2006-01-29 05:06:04 +0000
committerxue <>2006-01-29 05:06:04 +0000
commit8c89c21a89c114624ab20a8f48c304f0de3727b0 (patch)
treecadaf3b6767b2fc7fd9d5bc8d5360e9e34fd7ccf /framework/Log
parent397f1f02d104a08321e9500aa65e83e5b3d22c4e (diff)
LogRoutes now work when errors happen during application running.
Diffstat (limited to 'framework/Log')
-rw-r--r--framework/Log/TLogRouter.php22
1 files changed, 13 insertions, 9 deletions
diff --git a/framework/Log/TLogRouter.php b/framework/Log/TLogRouter.php
index 3292c4d3..ef16cb67 100644
--- a/framework/Log/TLogRouter.php
+++ b/framework/Log/TLogRouter.php
@@ -68,7 +68,7 @@ class TLogRouter extends TModule
throw new TConfigurationException('logrouter_configfile_invalid',$this->_configFile);
}
$this->loadConfig($config);
- //$this->getApplication()->attachEventHandler('OnError',array($this,'collectLogs'));
+ $this->getApplication()->attachEventHandler('OnError',array($this,'collectLogs'));
$this->getApplication()->attachEventHandler('OnEndRequest',array($this,'collectLogs'));
}
@@ -158,6 +158,7 @@ abstract class TLogRoute extends TComponent
TLogger::INFO=>'Info',
TLogger::NOTICE=>'Notice',
TLogger::WARNING=>'Warning',
+ TLogger::ERROR=>'Error',
TLogger::ALERT=>'Alert',
TLogger::FATAL=>'Fatal'
);
@@ -169,6 +170,7 @@ abstract class TLogRoute extends TComponent
'info'=>TLogger::INFO,
'notice'=>TLogger::NOTICE,
'warning'=>TLogger::WARNING,
+ 'error'=>TLogger::ERROR,
'alert'=>TLogger::ALERT,
'fatal'=>TLogger::FATAL
);
@@ -200,7 +202,7 @@ abstract class TLogRoute extends TComponent
/**
* @param integer|string integer log level filter (in bits). If the value is
* a string, it is assumed to be comma-separated level names. Valid level names
- * include 'Error', 'Debug', 'Info', 'Notice', 'Warning', 'Error', 'Alert' and 'Fatal'.
+ * include 'Debug', 'Info', 'Notice', 'Warning', 'Error', 'Alert' and 'Fatal'.
*/
public function setLevels($levels)
{
@@ -604,10 +606,11 @@ class TBrowserLogRoute extends TLogRoute
$string = <<<EOD
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
- <th style="background-color: black; color:white;" colspan="10">
+ <th style="background-color: black; color:white;" colspan="11">
<h3>Trace Information: $category</h3>
</th>
</tr><tr style="background-color: #ccc;">
+ <th>&nbsp;</th>
<th>Category</th><th>Message</th><th>From First(s)</th><th>From Last(s)</th>
</tr>
EOD;
@@ -622,8 +625,8 @@ EOD;
$color = $this->getColorLevel($log[1]);
$msg = preg_replace('/\(line[^\)]+\)$/','',$log[0]); //remove line number info
$string = <<<EOD
- <tr style="background-color: {$bgcolor}; color: {$color}">
- <td>{$log[2]}</td><td>{$msg}</td><td>{$total}</td><td>{$delta}</td>
+ <tr style="background-color: {$bgcolor};">
+ <td style="background-color: $color;">&nbsp;</td><td>{$log[2]}</td><td>{$msg}</td><td>{$total}</td><td>{$delta}</td>
</tr>
EOD;
return $string;
@@ -635,16 +638,17 @@ EOD;
{
case TLogger::DEBUG: return 'green';
case TLogger::INFO: return 'black';
- case TLogger::NOTICE: return 'blue';
- case TLogger::WARNING: return '#f63';
- case TLogger::ALERT: return '#c00';
+ case TLogger::NOTICE: return '#3333FF';
+ case TLogger::WARNING: return '#33FFFF';
+ case TLogger::ERROR: return '#ff9933';
+ case TLogger::ALERT: return '#ff00ff';
case TLogger::FATAL: return 'red';
}
}
protected function renderFooter()
{
- $string = "<tr><td colspan=\"10\" style=\"text-align:center; border-top: 1px solid #ccc; padding:0.2em;\">";
+ $string = "<tr><td colspan=\"11\" style=\"text-align:center; border-top: 1px solid #ccc; padding:0.2em;\">";
foreach(self::$_levelValues as $name => $level)
{
$string .= "<span style=\"color:".$this->getColorLevel($level);