From 001e69daef223679ad2331e61e78f45aec590f0a Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 20 Jan 2015 21:46:23 +0100 Subject: One class per file: framework/Util --- framework/Util/TFirebugLogRoute.php | 85 +++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 framework/Util/TFirebugLogRoute.php (limited to 'framework/Util/TFirebugLogRoute.php') diff --git a/framework/Util/TFirebugLogRoute.php b/framework/Util/TFirebugLogRoute.php new file mode 100644 index 00000000..4493e6f6 --- /dev/null +++ b/framework/Util/TFirebugLogRoute.php @@ -0,0 +1,85 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Util + */ + +/** + * TFirebugLogRoute class. + * + * TFirebugLogRoute prints selected log messages in the firebug log console. + * + * {@link http://www.getfirebug.com/ FireBug Website} + * + * @author Enrico Stahn , Christophe Boulain + * @package System.Util + * @since 3.1.2 + */ +class TFirebugLogRoute extends TBrowserLogRoute +{ + protected function renderHeader () + { + $string = << +/*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 = "[{$total}] [{$delta}] ".$msg; // Add time spent and cumulated time spent + $string = $logfunc . '(\'' . addslashes($msg) . '\');' . "\n"; + + return $string; + } + + + protected function renderFooter () + { + $string = << + +EOD; + + return $string; + } + + protected function getFirebugLoggingFunction($level) + { + switch ($level) + { + case TLogger::DEBUG: + case TLogger::INFO: + case TLogger::NOTICE: + return 'console.log'; + case TLogger::WARNING: + return 'console.warn'; + case TLogger::ERROR: + case TLogger::ALERT: + case TLogger::FATAL: + return 'console.error'; + default: + return 'console.log'; + } + } + +} \ No newline at end of file -- cgit v1.2.3