Source for file Debugtoolbar.php
Documentation is available at Debugtoolbar.php
/** Ethna_Plugin_Logwriter_DebugToolbar
* @author Sotaro KARASAWA <sotaro.k@gmail.com>
* @param int $level ログレベル(LOG_DEBUG, LOG_NOTICE...)
* @param string $message ログメッセージ(+引数)
function log($level, $message)
$pre_prefix =
'<div class="ethna-debug-log ethna-debug-log-' .
$this->_getLogLevelName($level) .
'">';
$prefix .=
sprintf($c->getGateway() !=
GATEWAY_WWW ?
'(%s): ' :
'(<span class="ethna-debug-log-loglevel ethna-debug-log-loglevel-' .
$this->_getLogLevelName($level) .
' ">%s</span>): ',
$this->_getLogLevelName($level)
if ($this->_getLogLevelName($level) !=
'DEBUG'
&&
preg_match('/in (template ")?(\/.+\.(php|tpl))"?\s+on line (\d+)/', $message, $match)) {
list
(, , $file, ,$line) =
$match;
$tracer .=
($c->getGateway() !=
GATEWAY_WWW ?
"" :
'<pre class="ethna-debug-pre">');
$f =
new SplFileObject($file);
$min =
($line -
4 <
0) ?
0 :
$line -
4;
foreach (new LimitIterator($f, $min, 7) as $line_str) {
$tracer .=
'<span class="ethna-debug-pre-blink">';
$tracer .=
($c->getGateway() !=
GATEWAY_WWW ?
"" :
'</pre>');
$bt =
$this->_getBacktrace();
$tmp .=
$tmp ?
sprintf('(%s)', $bt['pos']) :
$bt['pos'];
$log_content =
($pre_prefix .
$prefix .
$message .
$tracer .
$post_prefix .
"\n");
if ((!is_null($view =
$ctl->getView()) &&
!$view->has_default_header)
echo
'<div class="ethna-debug" id="ethna-debug-logwindow">';
echo
'<div class="ethna-debug-title">Log</div>';
if ((!is_null($view =
$ctl->getView()) &&
!$view->has_default_header)
echo
"<h1>Script shutdown unexpectedly</h1>";
* ログ出力箇所の情報(関数名/ファイル名等)を取得する
* @return array ログ出力箇所の情報
$skip_method_list =
array(
array(null, 'raiseerror'),
array(null, 'handleerror'),
array('ethna_logger', null),
array('ethna_plugin_logwriter', null),
array('ethna_error', null),
array('ethna_apperror', null),
array('ethna_actionerror', null),
array('ethna_backend', 'log'),
array(null, 'ethna_error_handler'),
array(null, 'trigger_error'),
array('ether_plugin_logwriter', null), // この1行を足すためにメソッドまるごとコピーですよ・・・
while ($i <
count($bt)) {
if (isset
($bt[$i]['class']) ==
false) {
foreach ($skip_method_list as $method) {
$class =
$function =
true;
if ($method[0] !=
null) {
$class =
preg_match("/^$method[0]/i", $bt[$i]['class']);
if ($method[1] !=
null) {
$function =
preg_match("/^$method[1]/i", $bt[$i]['function']);
if ($class &&
$function) {
$basedir =
$c->getBasedir();
$function =
sprintf("%s.%s", isset
($bt[$i]['class']) ?
$bt[$i]['class'] :
'global', $bt[$i]['function']);
return array('function' =>
$function, 'pos' =>
sprintf('%s:%s', $file, $line), 'file' =>
$orig_file);
Documentation generated on Fri, 11 Nov 2011 03:57:58 +0900 by phpDocumentor 1.4.3