summaryrefslogtreecommitdiff
path: root/framework/Util/TLogRouter.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Util/TLogRouter.php')
-rw-r--r--framework/Util/TLogRouter.php39
1 files changed, 23 insertions, 16 deletions
diff --git a/framework/Util/TLogRouter.php b/framework/Util/TLogRouter.php
index c944e17d..e060a85e 100644
--- a/framework/Util/TLogRouter.php
+++ b/framework/Util/TLogRouter.php
@@ -1048,8 +1048,8 @@ EOD;
$logfunc = $this->getFirebugLoggingFunction($log[1]);
$total = sprintf('%0.6f', $info['total']);
$delta = sprintf('%0.6f', $info['delta']);
- $msg = trim($this->formatLogMessage($log[0],$log[1],$log[2],''));
- $msg = preg_replace('/\(line[^\)]+\)$/','',$msg); //remove line number info
+ $msg = trim($this->formatLogMessage($log[0], $log[1], $log[2], ''));
+ $msg = preg_replace('/\(line[^\)]+\)$/', '', $msg); //remove line number info
$msg = "[{$total}] [{$delta}] ".$msg; // Add time spent and cumulated time spent
$string = $logfunc . '(\'' . addslashes($msg) . '\');' . "\n";
@@ -1083,8 +1083,9 @@ EOD;
case TLogger::ALERT:
case TLogger::FATAL:
return 'console.error';
+ default:
+ return 'console.log';
}
- return 'console.log';
}
}
@@ -1113,9 +1114,10 @@ class TFirePhpLogRoute extends TLogRoute
public function processLogs($logs)
{
- if(empty($logs) || $this->getApplication()->getMode()==='Performance') return;
+ if(empty($logs) || $this->getApplication()->getMode()==='Performance')
+ return;
- if( headers_sent() ) {
+ if(headers_sent()) {
echo '
<div style="width:100%; background-color:darkred; color:#FFF; padding:2px">
TFirePhpLogRoute.GroupLabel "<i>' . $this -> getGroupLabel() . '</i>" -
@@ -1129,11 +1131,9 @@ class TFirePhpLogRoute extends TLogRoute
require_once Prado::getPathOfNamespace('System.3rdParty.FirePHPCore') . '/FirePHP.class.php';
$firephp = FirePHP::getInstance(true);
- $firephp -> setOptions(array('useNativeJsonEncode' => false));
-
- $firephp -> group($this->getGroupLabel(), array('Collapsed' => true));
-
- $firephp ->log('Time, Message');
+ $firephp->setOptions(array('useNativeJsonEncode' => false));
+ $firephp->group($this->getGroupLabel(), array('Collapsed' => true));
+ $firephp->log('Time, Message');
$first = $logs[0][3];
$c = count($logs);
@@ -1154,13 +1154,18 @@ class TFirePhpLogRoute extends TLogRoute
$total = $logs[$i][3] - $first;
}
- $message = sPrintF('+%0.6f: %s', $delta, preg_replace('/\(line[^\)]+\)$/','',$message));
- $firephp ->fb($message, $category, self::translateLogLevel($level));
+ $message = sPrintF('+%0.6f: %s', $delta, preg_replace('/\(line[^\)]+\)$/', '', $message));
+ $firephp->fb($message, $category, self::translateLogLevel($level));
}
- $firephp ->log( sPrintF('%0.6f', $total), 'Cumulated Time');
- $firephp -> groupEnd();
+ $firephp->log(sPrintF('%0.6f', $total), 'Cumulated Time');
+ $firephp->groupEnd();
}
+ /**
+ * Translates a PRADO log level attribute into one understood by FirePHP for correct visualization
+ * @param string prado log level
+ * @return string FirePHP log level
+ */
protected static function translateLogLevel($level)
{
switch($level)
@@ -1176,8 +1181,9 @@ class TFirePhpLogRoute extends TLogRoute
case TLogger::ALERT:
case TLogger::FATAL:
return FirePHP::ERROR;
+ default:
+ return FirePHP::LOG;
}
- return FirePHP::LOG;
}
/**
@@ -1187,6 +1193,7 @@ class TFirePhpLogRoute extends TLogRoute
{
if($this->_groupLabel===null)
$this->_groupLabel=self::DEFAULT_LABEL;
+
return $this->_groupLabel;
}
@@ -1197,4 +1204,4 @@ class TFirePhpLogRoute extends TLogRoute
{
$this->_groupLabel=$value;
}
-} \ No newline at end of file
+}